Skip to content

Commit 619a290

Browse files
committed
Collect at callsite, use eprintln instead of println
1 parent d9a8a8a commit 619a290

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clippy_dev/src/stderr_length_check.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ const LIMIT: usize = 320;
1111

1212
pub fn check() {
1313
let stderr_files = stderr_files();
14-
let exceeding_files = exceeding_stderr_files(stderr_files);
14+
let exceeding_files = exceeding_stderr_files(stderr_files).collect::<Vec<String>>();
1515

1616
if !exceeding_files.is_empty() {
17-
println!("Error: stderr files exceeding limit of {} lines:", LIMIT);
17+
eprintln!("Error: stderr files exceeding limit of {} lines:", LIMIT);
1818
for path in exceeding_files {
1919
println!("{}", path);
2020
}
2121
std::process::exit(1);
2222
}
2323
}
2424

25-
fn exceeding_stderr_files(files: impl Iterator<Item = walkdir::DirEntry>) -> Vec<String> {
25+
fn exceeding_stderr_files(files: impl Iterator<Item = walkdir::DirEntry>) -> impl Iterator<Item = String> {
2626
files
2727
.filter_map(|file| {
2828
let path = file.path().to_str().expect("Could not convert path to str").to_string();
@@ -33,7 +33,6 @@ fn exceeding_stderr_files(files: impl Iterator<Item = walkdir::DirEntry>) -> Vec
3333
None
3434
}
3535
})
36-
.collect()
3736
}
3837

3938
fn stderr_files() -> impl Iterator<Item = walkdir::DirEntry> {

0 commit comments

Comments
 (0)