File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ use std::path::{Path, PathBuf};
44
55use walkdir:: WalkDir ;
66
7+ use clippy_dev:: clippy_project_root;
8+
79// The maximum length allowed for stderr files.
810//
911// We limit this because small files are easier to deal with than bigger files.
@@ -14,22 +16,24 @@ pub fn check() {
1416
1517 if !exceeding_files. is_empty ( ) {
1618 eprintln ! ( "Error: stderr files exceeding limit of {} lines:" , LENGTH_LIMIT ) ;
17- for path in exceeding_files {
18- println ! ( "{}" , path. display( ) ) ;
19+ for ( path, count ) in exceeding_files {
20+ println ! ( "{}: {} " , path. display( ) , count ) ;
1921 }
2022 std:: process:: exit ( 1 ) ;
2123 }
2224}
2325
24- fn exceeding_stderr_files ( ) -> Vec < PathBuf > {
26+ fn exceeding_stderr_files ( ) -> Vec < ( PathBuf , usize ) > {
2527 // We use `WalkDir` instead of `fs::read_dir` here in order to recurse into subdirectories.
26- WalkDir :: new ( "../ tests/ui")
28+ WalkDir :: new ( clippy_project_root ( ) . join ( " tests/ui") )
2729 . into_iter ( )
2830 . filter_map ( Result :: ok)
31+ . filter ( |f| !f. file_type ( ) . is_dir ( ) )
2932 . filter_map ( |e| {
3033 let p = e. into_path ( ) ;
31- if p. extension ( ) == Some ( OsStr :: new ( "stderr" ) ) && count_linenumbers ( & p) > LENGTH_LIMIT {
32- Some ( p)
34+ let count = count_linenumbers ( & p) ;
35+ if p. extension ( ) == Some ( OsStr :: new ( "stderr" ) ) && count > LENGTH_LIMIT {
36+ Some ( ( p, count) )
3337 } else {
3438 None
3539 }
You can’t perform that action at this time.
0 commit comments