From bbd71dfbc09bbcc68b08e78b667f9a098da29557 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Wed, 4 Mar 2026 13:00:02 -0500 Subject: [PATCH] Fix pre-existing clippy lints Co-Authored-By: Claude Opus 4.6 --- crates/arc-workflows/src/cli/run.rs | 69 ++++++++++---------- crates/arc-workflows/src/engine.rs | 2 +- crates/arc-workflows/src/handler/parallel.rs | 4 +- crates/arc-workflows/tests/integration.rs | 3 - 4 files changed, 37 insertions(+), 41 deletions(-) diff --git a/crates/arc-workflows/src/cli/run.rs b/crates/arc-workflows/src/cli/run.rs index 1ea40693e..3f3b8b199 100644 --- a/crates/arc-workflows/src/cli/run.rs +++ b/crates/arc-workflows/src/cli/run.rs @@ -733,42 +733,43 @@ pub async fn run_command( HumanDuration(Duration::from_millis(run_duration_ms)) ); - let acc = accumulator.lock().unwrap(); - let total_tokens = acc.total_input_tokens + acc.total_output_tokens; - if total_tokens > 0 { - if acc.has_pricing { - eprintln!( - "{}", - styles.dim.apply_to(format!( - "Cost: {} ({} tokens)", - format_cost(acc.total_cost), - format_tokens_human(total_tokens) - )) - ); - } else { - eprintln!("{}", styles.dim.apply_to(format!("Tokens: {}", format_tokens_human(total_tokens)))); - } - if acc.total_cache_read_tokens > 0 { - eprintln!( - "{}", - styles.dim.apply_to(format!( - "Cache: {} read, {} write", - format_tokens_human(acc.total_cache_read_tokens), - format_tokens_human(acc.total_cache_write_tokens), - )), - ); - } - if acc.total_reasoning_tokens > 0 { - eprintln!( - "{}", - styles.dim.apply_to(format!( - "Reasoning: {} tokens", - format_tokens_human(acc.total_reasoning_tokens), - )), - ); + { + let acc = accumulator.lock().unwrap(); + let total_tokens = acc.total_input_tokens + acc.total_output_tokens; + if total_tokens > 0 { + if acc.has_pricing { + eprintln!( + "{}", + styles.dim.apply_to(format!( + "Cost: {} ({} tokens)", + format_cost(acc.total_cost), + format_tokens_human(total_tokens) + )) + ); + } else { + eprintln!("{}", styles.dim.apply_to(format!("Tokens: {}", format_tokens_human(total_tokens)))); + } + if acc.total_cache_read_tokens > 0 { + eprintln!( + "{}", + styles.dim.apply_to(format!( + "Cache: {} read, {} write", + format_tokens_human(acc.total_cache_read_tokens), + format_tokens_human(acc.total_cache_write_tokens), + )), + ); + } + if acc.total_reasoning_tokens > 0 { + eprintln!( + "{}", + styles.dim.apply_to(format!( + "Reasoning: {} tokens", + format_tokens_human(acc.total_reasoning_tokens), + )), + ); + } } } - drop(acc); if let Some(failure) = outcome.failure_reason() { eprintln!("{}", styles.red.apply_to(format!("Failure: {failure}")),); diff --git a/crates/arc-workflows/src/engine.rs b/crates/arc-workflows/src/engine.rs index 3f3f70575..5575e13c6 100644 --- a/crates/arc-workflows/src/engine.rs +++ b/crates/arc-workflows/src/engine.rs @@ -1514,7 +1514,7 @@ impl WorkflowRunEngine { (None, Some(target.clone())) } else { let edge = select_edge(&node.id, &outcome, &context, graph); - if let Some(ref e) = edge { + if let Some(e) = &edge { self.services.emitter.emit(&WorkflowRunEvent::EdgeSelected { from_node: node.id.clone(), to_node: e.to.clone(), diff --git a/crates/arc-workflows/src/handler/parallel.rs b/crates/arc-workflows/src/handler/parallel.rs index f8d986f4f..83acc47b8 100644 --- a/crates/arc-workflows/src/handler/parallel.rs +++ b/crates/arc-workflows/src/handler/parallel.rs @@ -735,9 +735,7 @@ fn find_join_node(results: &[BranchResult], graph: &Graph) -> Option { } // Find the intersection — nodes reachable from ALL branches - let Some(first) = target_sets.first() else { - return None; - }; + let first = target_sets.first()?; let common: std::collections::HashSet<&String> = first .iter() .filter(|id| target_sets.iter().all(|set| set.contains(*id))) diff --git a/crates/arc-workflows/tests/integration.rs b/crates/arc-workflows/tests/integration.rs index 785657f6b..3994ae838 100644 --- a/crates/arc-workflows/tests/integration.rs +++ b/crates/arc-workflows/tests/integration.rs @@ -3,7 +3,6 @@ use std::path::Path; use std::sync::Arc; use arc_llm::provider::Provider; -use arc_util::terminal::Styles; use arc_workflows::checkpoint::Checkpoint; use arc_workflows::cli::backend::AgentApiBackend; use arc_workflows::context::Context; @@ -7169,8 +7168,6 @@ fn parse_tool_hooks_from_dot_syntax() { // E2E test with real LLM // --------------------------------------------------------------------------- -static TEST_STYLES: std::sync::LazyLock = std::sync::LazyLock::new(|| Styles::new(false)); - #[tokio::test] #[ignore = "requires ANTHROPIC_API_KEY"] async fn arc_e2e_with_real_llm() {