File tree 1 file changed +10
-6
lines changed
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};
4
4
5
5
use walkdir:: WalkDir ;
6
6
7
+ use clippy_dev:: clippy_project_root;
8
+
7
9
// The maximum length allowed for stderr files.
8
10
//
9
11
// We limit this because small files are easier to deal with than bigger files.
@@ -14,22 +16,24 @@ pub fn check() {
14
16
15
17
if !exceeding_files. is_empty ( ) {
16
18
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 ) ;
19
21
}
20
22
std:: process:: exit ( 1 ) ;
21
23
}
22
24
}
23
25
24
- fn exceeding_stderr_files ( ) -> Vec < PathBuf > {
26
+ fn exceeding_stderr_files ( ) -> Vec < ( PathBuf , usize ) > {
25
27
// 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") )
27
29
. into_iter ( )
28
30
. filter_map ( Result :: ok)
31
+ . filter ( |f| !f. file_type ( ) . is_dir ( ) )
29
32
. filter_map ( |e| {
30
33
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) )
33
37
} else {
34
38
None
35
39
}
You can’t perform that action at this time.
0 commit comments