style: apply cargo fmt formatting to tools/file.rs

This commit is contained in:
huqiantao
2026-06-07 19:44:25 +08:00
parent 4d1ffa4b88
commit 186b5b463f
+6 -4
View File
@@ -115,7 +115,9 @@ impl ToolSpec for ReadFileTool {
));
}
Some(v) => usize::try_from(v).map_err(|_| {
ToolError::invalid_input("start_line exceeds platform addressable range".to_string())
ToolError::invalid_input(
"start_line exceeds platform addressable range".to_string(),
)
})?,
None => 1,
};
@@ -301,9 +303,9 @@ fn clean_pdf_text(raw: &str) -> String {
if any_content {
let start = out.find(|c: char| c != '\n').unwrap_or(0);
// Walk back from end to find the last non-newline character.
let end = out
.rfind(|c: char| c != '\n')
.map_or(out.len(), |i| i + out[i..].chars().next().map_or(1, |c| c.len_utf8()));
let end = out.rfind(|c: char| c != '\n').map_or(out.len(), |i| {
i + out[i..].chars().next().map_or(1, |c| c.len_utf8())
});
out[start..end].to_string()
} else {
String::new()