style: apply cargo fmt formatting
This commit is contained in:
@@ -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() })),
|
||||
}
|
||||
|
||||
@@ -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::<Vec<_>>()
|
||||
.join(" ")
|
||||
.to_ascii_lowercase()
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user