From 4dd0a47c05650b216ea925b3902adf75e4d623dc Mon Sep 17 00:00:00 2001 From: huqiantao Date: Sun, 7 Jun 2026 19:46:24 +0800 Subject: [PATCH] style: apply cargo fmt formatting --- crates/app-server/src/lib.rs | 5 +---- crates/execpolicy/src/lib.rs | 3 ++- crates/tui/src/tools/file.rs | 15 ++++++++------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/crates/app-server/src/lib.rs b/crates/app-server/src/lib.rs index 40fcca49..97de02db 100644 --- a/crates/app-server/src/lib.rs +++ b/crates/app-server/src/lib.rs @@ -289,10 +289,7 @@ async fn tool_handler( }) .unwrap_or(codewhale_execpolicy::AskForApproval::OnRequest) }; - match runtime - .invoke_tool(req.call, approval_mode, &cwd) - .await - { + match runtime.invoke_tool(req.call, approval_mode, &cwd).await { Ok(value) => Json(value), Err(err) => Json(json!({ "ok": false, "error": err.to_string() })), } diff --git a/crates/execpolicy/src/lib.rs b/crates/execpolicy/src/lib.rs index 2d7b0b02..12897037 100644 --- a/crates/execpolicy/src/lib.rs +++ b/crates/execpolicy/src/lib.rs @@ -448,7 +448,8 @@ impl ExecPolicyEngine { fn normalize_command(value: &str) -> String { // Normalize: lowercase, collapse internal whitespace to single spaces. // This prevents bypass via "git status" (double space) vs "git status". - value.split_whitespace() + value + .split_whitespace() .collect::>() .join(" ") .to_ascii_lowercase() diff --git a/crates/tui/src/tools/file.rs b/crates/tui/src/tools/file.rs index 0307143f..f02124da 100644 --- a/crates/tui/src/tools/file.rs +++ b/crates/tui/src/tools/file.rs @@ -730,13 +730,14 @@ fn leading_whitespace_fuzzy_matches(contents: &str, search: &str) -> Vec<(usize, // when the match begins at a line boundary in the normalized text. // This prevents destroying preceding text on the same line when // the match starts mid-line after whitespace stripping. - let original_start = if norm_start == 0 || normalized_contents.as_bytes()[norm_start - 1] == b'\n' { - // Match starts at a line boundary — use line start for full-line replacement. - line_start_before(contents, mapped_start) - } else { - // Match starts mid-line — use the exact mapped position. - mapped_start - }; + let original_start = + if norm_start == 0 || normalized_contents.as_bytes()[norm_start - 1] == b'\n' { + // Match starts at a line boundary — use line start for full-line replacement. + line_start_before(contents, mapped_start) + } else { + // Match starts mid-line — use the exact mapped position. + mapped_start + }; let original_end = byte_map.get(norm_end).copied().unwrap_or(contents.len()); matches.push((original_start, original_end)); cursor = norm_start.saturating_add(1);