fix: resolve clippy pedantic warnings

Apply the bounded clippy pedantic cleanup from PR #3009.
This commit is contained in:
Heo, Sung
2026-06-03 20:39:05 +09:00
committed by GitHub
parent 1bd18be372
commit 0cef5390f7
2 changed files with 11 additions and 14 deletions

View File

@@ -737,7 +737,7 @@ fn format_hook_failure(command: &str, code: i32, stdout: Option<&str>, stderr: &
fn shell_command(command: &str) -> CommandWithStdin { fn shell_command(command: &str) -> CommandWithStdin {
#[cfg(windows)] #[cfg(windows)]
let mut command_builder = { let command_builder = {
let mut command_builder = Command::new("cmd"); let mut command_builder = Command::new("cmd");
command_builder.arg("/C").arg(command); command_builder.arg("/C").arg(command);
CommandWithStdin::new(command_builder) CommandWithStdin::new(command_builder)

View File

@@ -77,12 +77,12 @@ const DEFAULT_MODEL: &str = "anthropic/claude-opus-4-6";
enum ModelSource { enum ModelSource {
/// Explicit `--model` / `--model=` CLI flag. /// Explicit `--model` / `--model=` CLI flag.
Flag, Flag,
/// ANTHROPIC_MODEL environment variable (when no flag was passed). /// `ANTHROPIC_MODEL` environment variable (when no flag was passed).
Env, Env,
/// `model` key in `.claw.json` / `.claw/settings.json` (when neither /// `model` key in `.claw.json` / `.claw/settings.json` (when neither
/// flag nor env set it). /// flag nor env set it).
Config, Config,
/// Compiled-in DEFAULT_MODEL fallback. /// Compiled-in `DEFAULT_MODEL` fallback.
Default, Default,
} }
@@ -266,7 +266,7 @@ Run `claw --help` for usage."
/// #77: Classify a stringified error message into a machine-readable kind. /// #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 /// of regex-scraping the prose. The classification is best-effort prefix/keyword
/// matching against the error messages produced throughout the CLI surface. /// matching against the error messages produced throughout the CLI surface.
fn classify_error_kind(message: &str) -> &'static str { fn classify_error_kind(message: &str) -> &'static str {
@@ -390,9 +390,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 /// 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 /// runbook prose from being stuffed into the `error` field that downstream
/// parsers expect to be the short reason alone. /// parsers expect to be the short reason alone.
@@ -6605,8 +6605,8 @@ impl LiveCli {
// Propagate ok:false → non-zero exit so automation callers // Propagate ok:false → non-zero exit so automation callers
// can rely on exit code instead of inspecting the envelope. // can rely on exit code instead of inspecting the envelope.
// (#68: mcp error envelopes previously always exited 0.) // (#68: mcp error envelopes previously always exited 0.)
let is_error = value.get("ok").and_then(|v| v.as_bool()) == Some(false) let is_error = value.get("ok").and_then(serde_json::Value::as_bool) == Some(false)
|| value.get("status").and_then(|v| v.as_str()) == Some("error"); || value.get("status").and_then(serde_json::Value::as_str) == Some("error");
println!("{}", serde_json::to_string_pretty(&value)?); println!("{}", serde_json::to_string_pretty(&value)?);
if is_error { if is_error {
std::process::exit(1); std::process::exit(1);
@@ -8735,8 +8735,7 @@ fn render_diff_report_for(cwd: &Path) -> Result<String, Box<dyn std::error::Erro
.args(["rev-parse", "--is-inside-work-tree"]) .args(["rev-parse", "--is-inside-work-tree"])
.current_dir(cwd) .current_dir(cwd)
.output() .output()
.map(|o| o.status.success()) .is_ok_and(|o| o.status.success());
.unwrap_or(false);
if !in_git_repo { if !in_git_repo {
return Ok(format!( return Ok(format!(
"Diff\n Result no git repository\n Detail {} is not inside a git project", "Diff\n Result no git repository\n Detail {} is not inside a git project",
@@ -8768,8 +8767,7 @@ fn render_diff_json_for(cwd: &Path) -> Result<serde_json::Value, Box<dyn std::er
.args(["rev-parse", "--is-inside-work-tree"]) .args(["rev-parse", "--is-inside-work-tree"])
.current_dir(cwd) .current_dir(cwd)
.output() .output()
.map(|o| o.status.success()) .is_ok_and(|o| o.status.success());
.unwrap_or(false);
if !in_git_repo { if !in_git_repo {
// #801: add error_kind, hint, message fields for envelope parity with other error paths // #801: add error_kind, hint, message fields for envelope parity with other error paths
return Ok(serde_json::json!({ return Ok(serde_json::json!({
@@ -9020,8 +9018,7 @@ fn command_exists(name: &str) -> bool {
Command::new("which") Command::new("which")
.arg(name) .arg(name)
.output() .output()
.map(|output| output.status.success()) .is_ok_and(|output| output.status.success())
.unwrap_or(false)
} }
fn write_temp_text_file( fn write_temp_text_file(