diff options
| author | flip1995 <hello@philkrones.com> | 2020-03-18 15:27:25 +0100 |
|---|---|---|
| committer | flip1995 <hello@philkrones.com> | 2020-03-18 15:27:25 +0100 |
| commit | f041dcdb4e47b01e5a22f86054ad57d42ed17f4a (patch) | |
| tree | ba827a788603092ae1308633ea713c33278f3c51 /clippy_dev | |
| parent | a808779441bc6fdd6ea4c78366229d5c660d6abf (diff) | |
| download | rust-f041dcdb4e47b01e5a22f86054ad57d42ed17f4a.tar.gz rust-f041dcdb4e47b01e5a22f86054ad57d42ed17f4a.zip | |
Fix limit-stderr-files test
Diffstat (limited to 'clippy_dev')
| -rw-r--r-- | clippy_dev/src/stderr_length_check.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/clippy_dev/src/stderr_length_check.rs b/clippy_dev/src/stderr_length_check.rs index 041ee691137..c511733f7bf 100644 --- a/clippy_dev/src/stderr_length_check.rs +++ b/clippy_dev/src/stderr_length_check.rs @@ -4,6 +4,8 @@ use std::path::{Path, PathBuf}; use walkdir::WalkDir; +use clippy_dev::clippy_project_root; + // The maximum length allowed for stderr files. // // We limit this because small files are easier to deal with than bigger files. @@ -14,22 +16,24 @@ pub fn check() { if !exceeding_files.is_empty() { eprintln!("Error: stderr files exceeding limit of {} lines:", LENGTH_LIMIT); - for path in exceeding_files { - println!("{}", path.display()); + for (path, count) in exceeding_files { + println!("{}: {}", path.display(), count); } std::process::exit(1); } } -fn exceeding_stderr_files() -> Vec<PathBuf> { +fn exceeding_stderr_files() -> Vec<(PathBuf, usize)> { // We use `WalkDir` instead of `fs::read_dir` here in order to recurse into subdirectories. - WalkDir::new("../tests/ui") + WalkDir::new(clippy_project_root().join("tests/ui")) .into_iter() .filter_map(Result::ok) + .filter(|f| !f.file_type().is_dir()) .filter_map(|e| { let p = e.into_path(); - if p.extension() == Some(OsStr::new("stderr")) && count_linenumbers(&p) > LENGTH_LIMIT { - Some(p) + let count = count_linenumbers(&p); + if p.extension() == Some(OsStr::new("stderr")) && count > LENGTH_LIMIT { + Some((p, count)) } else { None } |
