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(