From 65e3a0bcee662a17c81d83d08168c4dbf66821bd Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Thu, 5 Mar 2026 10:11:44 -0500 Subject: [PATCH] Fix pre-existing clippy warnings in arc-workflows - Replace useless format!() with .to_string() in parse_decision - Derive Default for HookDecision instead of manual impl - Use contains_key() instead of get().is_none() in semantic parser Co-Authored-By: Claude Opus 4.6 --- crates/arc-workflows/src/hook/executor.rs | 2 +- crates/arc-workflows/src/hook/types.rs | 8 ++------ crates/arc-workflows/src/parser/semantic.rs | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/arc-workflows/src/hook/executor.rs b/crates/arc-workflows/src/hook/executor.rs index 675af329b..45df35cb4 100644 --- a/crates/arc-workflows/src/hook/executor.rs +++ b/crates/arc-workflows/src/hook/executor.rs @@ -96,7 +96,7 @@ impl HookExecutorImpl { return decision; } HookDecision::Block { - reason: Some(format!("hook exited with code 2")), + reason: Some("hook exited with code 2".to_string()), } } else { HookDecision::Block { diff --git a/crates/arc-workflows/src/hook/types.rs b/crates/arc-workflows/src/hook/types.rs index de23529e9..6bd99471b 100644 --- a/crates/arc-workflows/src/hook/types.rs +++ b/crates/arc-workflows/src/hook/types.rs @@ -108,9 +108,10 @@ pub struct PromptHookResponse { } /// Decision returned by blocking hooks. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] #[serde(tag = "decision", rename_all = "snake_case")] pub enum HookDecision { + #[default] Proceed, Skip { #[serde(default)] @@ -125,11 +126,6 @@ pub enum HookDecision { }, } -impl Default for HookDecision { - fn default() -> Self { - Self::Proceed - } -} impl HookDecision { /// Merge two decisions. Block > Skip/Override > Proceed. diff --git a/crates/arc-workflows/src/parser/semantic.rs b/crates/arc-workflows/src/parser/semantic.rs index 04ec5e382..93f55e275 100644 --- a/crates/arc-workflows/src/parser/semantic.rs +++ b/crates/arc-workflows/src/parser/semantic.rs @@ -109,7 +109,7 @@ impl SemanticState { Self::add_class_to_node(node, cls); } // Legacy: translate codergen_mode to type if type is not explicitly set - if node.attrs.get("type").is_none() { + if !node.attrs.contains_key("type") { if let Some(mode) = node.attrs.get("codergen_mode").and_then(AttrValue::as_str) { let mapped = match mode { "one_shot" => "prompt",