@@ -426,20 +426,17 @@ impl<'a> CrateLocator<'a> {
426
426
info ! ( "lib candidate: {}" , spf. path. display( ) ) ;
427
427
428
428
let ( rlibs, rmetas, dylibs) = candidates. entry ( hash. to_string ( ) ) . or_default ( ) ;
429
- fs:: canonicalize ( & spf. path )
430
- . map ( |p| {
431
- if seen_paths. contains ( & p) {
432
- return FileDoesntMatch ;
433
- } ;
434
- seen_paths. insert ( p. clone ( ) ) ;
435
- match found_kind {
436
- CrateFlavor :: Rlib => rlibs. insert ( p, kind) ,
437
- CrateFlavor :: Rmeta => rmetas. insert ( p, kind) ,
438
- CrateFlavor :: Dylib => dylibs. insert ( p, kind) ,
439
- } ;
440
- FileMatches
441
- } )
442
- . unwrap_or ( FileDoesntMatch )
429
+ let path = fs:: canonicalize ( & spf. path ) . unwrap_or_else ( |_| spf. path . clone ( ) ) ;
430
+ if seen_paths. contains ( & path) {
431
+ return FileDoesntMatch ;
432
+ } ;
433
+ seen_paths. insert ( path. clone ( ) ) ;
434
+ match found_kind {
435
+ CrateFlavor :: Rlib => rlibs. insert ( path, kind) ,
436
+ CrateFlavor :: Rmeta => rmetas. insert ( path, kind) ,
437
+ CrateFlavor :: Dylib => dylibs. insert ( path, kind) ,
438
+ } ;
439
+ FileMatches
443
440
} ) ;
444
441
self . rejected_via_kind . extend ( staticlibs) ;
445
442
@@ -688,12 +685,13 @@ impl<'a> CrateLocator<'a> {
688
685
&& file. ends_with ( & self . target . options . dll_suffix )
689
686
{
690
687
// Make sure there's at most one rlib and at most one dylib.
688
+ let loc = fs:: canonicalize ( & loc) . unwrap_or_else ( |_| loc. clone ( ) ) ;
691
689
if loc. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . ends_with ( ".rlib" ) {
692
- rlibs. insert ( fs :: canonicalize ( & loc) . unwrap ( ) , PathKind :: ExternFlag ) ;
690
+ rlibs. insert ( loc, PathKind :: ExternFlag ) ;
693
691
} else if loc. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . ends_with ( ".rmeta" ) {
694
- rmetas. insert ( fs :: canonicalize ( & loc) . unwrap ( ) , PathKind :: ExternFlag ) ;
692
+ rmetas. insert ( loc, PathKind :: ExternFlag ) ;
695
693
} else {
696
- dylibs. insert ( fs :: canonicalize ( & loc) . unwrap ( ) , PathKind :: ExternFlag ) ;
694
+ dylibs. insert ( loc, PathKind :: ExternFlag ) ;
697
695
}
698
696
} else {
699
697
self . rejected_via_filename
0 commit comments