@@ -40,7 +40,7 @@ impl FileFormatter {
40
40
warn ! ( "'{}' is not a valid file path/glob" , path) ;
41
41
}
42
42
43
- fn get_valid_files < S : AsRef < str > > ( & self , paths : & [ S ] ) -> Vec < PathBuf > {
43
+ fn find_files < S : AsRef < str > > ( & self , paths : & [ S ] ) -> Vec < PathBuf > {
44
44
let mut valid_paths = vec ! [ ] ;
45
45
paths. iter ( ) . map ( AsRef :: as_ref) . for_each ( |path_str| {
46
46
let path = Path :: new ( path_str) ;
@@ -55,16 +55,16 @@ impl FileFormatter {
55
55
}
56
56
} ) ) ;
57
57
}
58
- Ok ( metadata) if metadata. is_file ( ) => {
59
- valid_paths. push ( path. to_path_buf ( ) ) ;
60
- }
61
- _ => match glob ( path_str) {
58
+ _ if path_str. contains ( '*' ) => match glob ( path_str) {
62
59
Err ( _) => self . warn_invalid_glob ( path_str) ,
63
60
Ok ( glob) => glob. for_each ( |entry| match entry {
64
61
Err ( _) => self . warn_invalid_file ( path_str) ,
65
62
Ok ( path) => valid_paths. push ( path) ,
66
63
} ) ,
67
64
} ,
65
+ _ => {
66
+ valid_paths. push ( path. to_path_buf ( ) ) ;
67
+ }
68
68
}
69
69
} ) ;
70
70
@@ -116,9 +116,7 @@ impl FileFormatter {
116
116
{
117
117
open_options. read ( true ) ;
118
118
119
- let valid_paths: Vec < _ > = self . get_valid_files ( paths) ;
120
-
121
- valid_paths
119
+ self . find_files ( paths)
122
120
. into_par_iter ( )
123
121
. map_init (
124
122
|| ( Vec :: < u8 > :: new ( ) , String :: new ( ) ) ,
0 commit comments