@@ -438,7 +438,8 @@ impl<'a> CrateLocator<'a> {
438438 }
439439 if let Some ( matches) = spf. query ( prefix, suffix) {
440440 for ( hash, spf) in matches {
441- info ! ( "lib candidate: {}" , spf. path. display( ) ) ;
441+ let spf_path = spf. path ( ) ;
442+ info ! ( "lib candidate: {}" , spf_path. display( ) ) ;
442443
443444 let ( rlibs, rmetas, dylibs, interfaces) =
444445 candidates. entry ( hash) . or_default ( ) ;
@@ -447,21 +448,20 @@ impl<'a> CrateLocator<'a> {
447448 // ones we've already seen. This allows us to ignore crates
448449 // we know are exactual equal to ones we've already found.
449450 // Going to the same crate through different symlinks does not change the result.
450- let path = try_canonicalize ( & spf . path )
451- . unwrap_or_else ( |_| spf . path . to_path_buf ( ) ) ;
451+ let path =
452+ try_canonicalize ( & spf_path ) . unwrap_or_else ( |_| spf_path . clone ( ) ) ;
452453 if seen_paths. contains ( & path) {
453454 continue ;
454455 } ;
455456 seen_paths. insert ( path) ;
456457 }
457458 // Use the original path (potentially with unresolved symlinks),
458459 // filesystem code should not care, but this is nicer for diagnostics.
459- let path = spf. path . to_path_buf ( ) ;
460460 match kind {
461- CrateFlavor :: Rlib => rlibs. insert ( path ) ,
462- CrateFlavor :: Rmeta => rmetas. insert ( path ) ,
463- CrateFlavor :: Dylib => dylibs. insert ( path ) ,
464- CrateFlavor :: SDylib => interfaces. insert ( path ) ,
461+ CrateFlavor :: Rlib => rlibs. insert ( spf_path ) ,
462+ CrateFlavor :: Rmeta => rmetas. insert ( spf_path ) ,
463+ CrateFlavor :: Dylib => dylibs. insert ( spf_path ) ,
464+ CrateFlavor :: SDylib => interfaces. insert ( spf_path ) ,
465465 } ;
466466 }
467467 }
@@ -471,10 +471,9 @@ impl<'a> CrateLocator<'a> {
471471 . flatten ( )
472472 {
473473 for ( _, spf) in static_matches {
474- crate_rejections. via_kind . push ( CrateMismatch {
475- path : spf. path . to_path_buf ( ) ,
476- got : "static" . to_string ( ) ,
477- } ) ;
474+ crate_rejections
475+ . via_kind
476+ . push ( CrateMismatch { path : spf. path ( ) , got : "static" . to_string ( ) } ) ;
478477 }
479478 }
480479 }
0 commit comments