From 75e641af67b75a8ba9560ca2ca8eee17f319bc1e Mon Sep 17 00:00:00 2001 From: "Heo, Sung" Date: Sat, 9 May 2026 13:10:15 +0900 Subject: [PATCH 1/2] fix: resolve clippy pedantic warnings across workspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address clippy::pedantic and clippy::all warnings without changing any public API or runtime behavior: - map().unwrap_or() → map_or() / is_ok_and() (8 instances) - match_same_arms: merge identical match arms (3 instances) - collapsible_match / unnested_or_patterns → if let (1 instance) - doc_markdown: backtick-wrap identifiers in doc comments (5 instances) - useless_format: format!(literal) → literal.to_string() (1 instance) - unnecessary_lazy_evaluations (1 instance) - redundant_closure (1 instance) - redundant match arm subsumed by wildcard (1 instance) - unused import (1 instance) - unnecessary mut (1 instance) - collapsible nested if into match guard (1 instance) Remaining warnings (intentionally skipped) involve signature changes (unnecessary_wraps), large enum refactoring (result_large_err), function splitting (too_many_lines), MSRV concerns (duration_suboptimal_units), or private-module method references (redundant_closure on runtime::json). Co-Authored-By: Claude Opus 4.6 --- rust/crates/plugins/src/hooks.rs | 1 - rust/crates/runtime/src/hooks.rs | 2 +- rust/crates/rusty-claude-cli/src/main.rs | 37 ++++++++++-------------- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/rust/crates/plugins/src/hooks.rs b/rust/crates/plugins/src/hooks.rs index ff02c2ac27..b8ee8a5ed9 100644 --- a/rust/crates/plugins/src/hooks.rs +++ b/rust/crates/plugins/src/hooks.rs @@ -1,5 +1,4 @@ use std::ffi::OsStr; -use std::path::Path; use std::process::Command; use serde_json::json; diff --git a/rust/crates/runtime/src/hooks.rs b/rust/crates/runtime/src/hooks.rs index 6abd69fbbd..a79c2d5d35 100644 --- a/rust/crates/runtime/src/hooks.rs +++ b/rust/crates/runtime/src/hooks.rs @@ -737,7 +737,7 @@ fn format_hook_failure(command: &str, code: i32, stdout: Option<&str>, stderr: & fn shell_command(command: &str) -> CommandWithStdin { #[cfg(windows)] - let mut command_builder = { + let command_builder = { let mut command_builder = Command::new("cmd"); command_builder.arg("/C").arg(command); CommandWithStdin::new(command_builder) diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs index e7303bcadc..f26f6d389a 100644 --- a/rust/crates/rusty-claude-cli/src/main.rs +++ b/rust/crates/rusty-claude-cli/src/main.rs @@ -77,12 +77,12 @@ const DEFAULT_MODEL: &str = "anthropic/claude-opus-4-6"; enum ModelSource { /// Explicit `--model` / `--model=` CLI flag. Flag, - /// ANTHROPIC_MODEL environment variable (when no flag was passed). + /// `ANTHROPIC_MODEL` environment variable (when no flag was passed). Env, /// `model` key in `.claw.json` / `.claw/settings.json` (when neither /// flag nor env set it). Config, - /// Compiled-in DEFAULT_MODEL fallback. + /// Compiled-in `DEFAULT_MODEL` fallback. Default, } @@ -261,7 +261,7 @@ Run `claw --help` for usage." /// #77: Classify a stringified error message into a machine-readable kind. /// -/// Returns a snake_case token that downstream consumers can switch on instead +/// Returns a `snake_case` token that downstream consumers can switch on instead /// of regex-scraping the prose. The classification is best-effort prefix/keyword /// matching against the error messages produced throughout the CLI surface. fn classify_error_kind(message: &str) -> &'static str { @@ -321,9 +321,9 @@ fn classify_error_kind(message: &str) -> &'static str { } } -/// #77: Split a multi-line error message into (short_reason, optional_hint). +/// #77: Split a multi-line error message into (`short_reason`, `optional_hint`). /// -/// The short_reason is the first line (up to the first newline), and the hint +/// The `short_reason` is the first line (up to the first newline), and the hint /// is the remaining text or `None` if there's no newline. This prevents the /// runbook prose from being stuffed into the `error` field that downstream /// parsers expect to be the short reason alone. @@ -4317,14 +4317,12 @@ fn run_resume_command( } SlashCommand::Plugins { action, target } => { // Only list is supported in resume mode (no runtime to reload) - match action.as_deref() { - Some("install") | Some("uninstall") | Some("enable") | Some("disable") - | Some("update") => { - return Err( - "resumed /plugins mutations are interactive-only; start `claw` and run `/plugins` in the REPL".into(), - ); - } - _ => {} + if let Some("install" | "uninstall" | "enable" | "disable" | "update") = + action.as_deref() + { + return Err( + "resumed /plugins mutations are interactive-only; start `claw` and run `/plugins` in the REPL".into(), + ); } let cwd = env::current_dir()?; let payload = plugins_command_payload_for(&cwd, action.as_deref(), target.as_deref())?; @@ -6033,8 +6031,8 @@ impl LiveCli { // Propagate ok:false → non-zero exit so automation callers // can rely on exit code instead of inspecting the envelope. // (#68: mcp error envelopes previously always exited 0.) - let is_error = value.get("ok").and_then(|v| v.as_bool()) == Some(false) - || value.get("status").and_then(|v| v.as_str()) == Some("error"); + let is_error = value.get("ok").and_then(serde_json::Value::as_bool) == Some(false) + || value.get("status").and_then(serde_json::Value::as_str) == Some("error"); println!("{}", serde_json::to_string_pretty(&value)?); if is_error { std::process::exit(1); @@ -7907,8 +7905,7 @@ fn render_diff_report_for(cwd: &Path) -> Result Result bool { Command::new("which") .arg(name) .output() - .map(|output| output.status.success()) - .unwrap_or(false) + .is_ok_and(|output| output.status.success()) } fn write_temp_text_file( From 1887681ddbee7265a6396113be5bd77caf105909 Mon Sep 17 00:00:00 2001 From: "Heo, Sung" Date: Sun, 10 May 2026 19:31:20 +0900 Subject: [PATCH 2/2] fix: restore missing Path import in plugins/hooks.rs Co-Authored-By: Claude Opus 4.6 --- rust/crates/plugins/src/hooks.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/crates/plugins/src/hooks.rs b/rust/crates/plugins/src/hooks.rs index b8ee8a5ed9..ff02c2ac27 100644 --- a/rust/crates/plugins/src/hooks.rs +++ b/rust/crates/plugins/src/hooks.rs @@ -1,4 +1,5 @@ use std::ffi::OsStr; +use std::path::Path; use std::process::Command; use serde_json::json;