Skip to content

Commit

Permalink
cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Virv12 committed Oct 17, 2024
1 parent 2306238 commit 271d80b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/tools/find_bad_case/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,13 @@ fn print_file(
let content = String::from_utf8_lossy(&file);
const MAX_CONTENT_LEN: usize = 256;
if content.len() > MAX_CONTENT_LEN {
println!("{}...\n", &content[..MAX_CONTENT_LEN].trim_end());
let prefix = (0..MAX_CONTENT_LEN)
.rev()
.filter_map(|idx| content.split_at_checked(idx))
.next()
.unwrap()
.0;
println!("{}...\n", prefix.trim_end());
} else {
println!("{}\n", content.trim_end());
}
Expand Down

0 comments on commit 271d80b

Please sign in to comment.