@@ -27,23 +27,23 @@ pub fn get_cargo_workspace() -> &'static Path {
2727
2828pub fn walk_dir < ' a > (
2929 root : & ' _ Path ,
30- skip : & ' a [ impl AsRef < OsStr > ] ,
31- ext : impl for < ' s > Fn ( Option < & ' s std:: ffi:: OsStr > ) -> bool + ' static ,
32- ) -> impl Iterator < Item = Result < walkdir:: DirEntry , walkdir:: Error > > + ' a {
33- walkdir:: WalkDir :: new ( root)
34- . into_iter ( )
30+ skip : & ' static [ impl AsRef < OsStr > + Send + Sync + ' a ] ,
31+ ext : impl for < ' s > Fn ( Option < & ' s std:: ffi:: OsStr > ) -> bool + Sync + Send + ' static ,
32+ ) -> impl Iterator < Item = Result < ignore:: DirEntry , ignore:: Error > > {
33+ ignore:: WalkBuilder :: new ( root)
3534 . filter_entry ( move |e| {
3635 if skip
3736 . iter ( )
3837 . map ( |s| -> & std:: ffi:: OsStr { s. as_ref ( ) } )
3938 . any ( |dir| e. file_name ( ) == dir)
4039 {
4140 return false ;
42- } else if e. file_type ( ) . is_dir ( ) {
41+ } else if e. file_type ( ) . map_or ( false , |f| f . is_dir ( ) ) {
4342 return true ;
4443 }
4544 ext ( e. path ( ) . extension ( ) )
4645 } )
46+ . build ( )
4747}
4848
4949#[ test]
@@ -134,9 +134,10 @@ release: {version}
134134fn check_newlines ( ) -> crate :: Result < ( ) > {
135135 for file in walk_dir ( get_cargo_workspace ( ) , & [ ".git" , "target" ] , |_| true ) {
136136 let file = file?;
137- if !file. file_type ( ) . is_file ( ) {
137+ if !file. file_type ( ) . map_or ( true , |f| f . is_file ( ) ) {
138138 continue ;
139139 }
140+ eprintln ! ( "File: {:?}" , file. path( ) ) ;
140141 assert ! (
141142 crate :: file:: read( file. path( ) )
142143 . unwrap_or_else( |_| String :: from( "\n " ) )
0 commit comments