@@ -68,33 +68,32 @@ impl<'a> FileSearch<'a> {
68
68
{
69
69
self . for_each_lib_search_path ( |lib_search_path, kind| {
70
70
debug ! ( "searching {}" , lib_search_path. display( ) ) ;
71
- match fs:: read_dir ( lib_search_path) {
72
- Ok ( files) => {
73
- let files = files. filter_map ( |p| p. ok ( ) . map ( |s| s. path ( ) ) )
74
- . collect :: < Vec < _ > > ( ) ;
75
- fn is_rlib ( p : & Path ) -> bool {
76
- p. extension ( ) . and_then ( |s| s. to_str ( ) ) == Some ( "rlib" )
71
+ let files = match fs:: read_dir ( lib_search_path) {
72
+ Ok ( files) => files,
73
+ Err ( ..) => return ,
74
+ } ;
75
+ let files = files. filter_map ( |p| p. ok ( ) . map ( |s| s. path ( ) ) )
76
+ . collect :: < Vec < _ > > ( ) ;
77
+ fn is_rlib ( p : & Path ) -> bool {
78
+ p. extension ( ) . and_then ( |s| s. to_str ( ) ) == Some ( "rlib" )
79
+ }
80
+ // Reading metadata out of rlibs is faster, and if we find both
81
+ // an rlib and a dylib we only read one of the files of
82
+ // metadata, so in the name of speed, bring all rlib files to
83
+ // the front of the search list.
84
+ let files1 = files. iter ( ) . filter ( |p| is_rlib ( p) ) ;
85
+ let files2 = files. iter ( ) . filter ( |p| !is_rlib ( p) ) ;
86
+ for path in files1. chain ( files2) {
87
+ debug ! ( "testing {}" , path. display( ) ) ;
88
+ let maybe_picked = pick ( path, kind) ;
89
+ match maybe_picked {
90
+ FileMatches => {
91
+ debug ! ( "picked {}" , path. display( ) ) ;
77
92
}
78
- // Reading metadata out of rlibs is faster, and if we find both
79
- // an rlib and a dylib we only read one of the files of
80
- // metadata, so in the name of speed, bring all rlib files to
81
- // the front of the search list.
82
- let files1 = files. iter ( ) . filter ( |p| is_rlib ( p) ) ;
83
- let files2 = files. iter ( ) . filter ( |p| !is_rlib ( p) ) ;
84
- for path in files1. chain ( files2) {
85
- debug ! ( "testing {}" , path. display( ) ) ;
86
- let maybe_picked = pick ( path, kind) ;
87
- match maybe_picked {
88
- FileMatches => {
89
- debug ! ( "picked {}" , path. display( ) ) ;
90
- }
91
- FileDoesntMatch => {
92
- debug ! ( "rejected {}" , path. display( ) ) ;
93
- }
94
- }
93
+ FileDoesntMatch => {
94
+ debug ! ( "rejected {}" , path. display( ) ) ;
95
95
}
96
96
}
97
- Err ( ..) => ( ) ,
98
97
}
99
98
} ) ;
100
99
}
0 commit comments