From b03c3c3d1faeb085b9d739fb6efde3be89e64760 Mon Sep 17 00:00:00 2001 From: kevin zhao Date: Mon, 10 Nov 2025 19:01:32 -0800 Subject: [PATCH] more early return lines --- codex-rs/execpolicy2/src/main.rs | 1 + codex-rs/execpolicy2/src/parser.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/codex-rs/execpolicy2/src/main.rs b/codex-rs/execpolicy2/src/main.rs index 071c7e0918..f4cae31f59 100644 --- a/codex-rs/execpolicy2/src/main.rs +++ b/codex-rs/execpolicy2/src/main.rs @@ -50,5 +50,6 @@ fn load_policy(policy_path: Option) -> Result let parser = PolicyParser::new(&path, &content); return Ok(parser.parse()?); } + Ok(load_default_policy()?) } diff --git a/codex-rs/execpolicy2/src/parser.rs b/codex-rs/execpolicy2/src/parser.rs index c21321b88a..177282aca0 100644 --- a/codex-rs/execpolicy2/src/parser.rs +++ b/codex-rs/execpolicy2/src/parser.rs @@ -92,6 +92,7 @@ fn parse_pattern<'v>(pattern: UnpackList>) -> Result if tokens.is_empty() { return Err(Error::InvalidPattern("pattern cannot be empty".to_string())); } + Ok(tokens) } @@ -99,6 +100,7 @@ fn parse_pattern_token<'v>(value: Value<'v>) -> Result { if let Some(s) = value.unpack_str() { return Ok(PatternToken::Single(s.to_string())); } + if let Some(list) = ListRef::from_value(value) { let mut tokens = Vec::new(); for value in list.content() { @@ -139,6 +141,7 @@ fn parse_examples<'v>(examples: UnpackList>) -> Result "example cannot be an empty list".to_string(), )); } + parsed.push(tokens); } Ok(parsed)