@@ -413,11 +413,15 @@ impl<'a> CrateLocator<'a> {
413
413
debug ! ( "searching {}" , search_path. dir. display( ) ) ;
414
414
let spf = & search_path. files ;
415
415
416
+ let mut should_check_staticlibs = true ;
416
417
for ( prefix, suffix, kind) in [
417
418
( rlib_prefix. as_str ( ) , rlib_suffix, CrateFlavor :: Rlib ) ,
418
419
( rmeta_prefix. as_str ( ) , rmeta_suffix, CrateFlavor :: Rmeta ) ,
419
420
( dylib_prefix, dylib_suffix, CrateFlavor :: Dylib ) ,
420
421
] {
422
+ if prefix == staticlib_prefix && suffix == staticlib_suffix {
423
+ should_check_staticlibs = false ;
424
+ }
421
425
if let Some ( matches) = spf. query ( prefix, suffix) {
422
426
for ( hash, spf) in matches {
423
427
info ! ( "lib candidate: {}" , spf. path. display( ) ) ;
@@ -438,7 +442,10 @@ impl<'a> CrateLocator<'a> {
438
442
}
439
443
}
440
444
}
441
- if let Some ( static_matches) = spf. query ( staticlib_prefix, staticlib_suffix) {
445
+ if let Some ( static_matches) = should_check_staticlibs
446
+ . then ( || spf. query ( staticlib_prefix, staticlib_suffix) )
447
+ . flatten ( )
448
+ {
442
449
for ( _, spf) in static_matches {
443
450
self . crate_rejections . via_kind . push ( CrateMismatch {
444
451
path : spf. path . to_path_buf ( ) ,
0 commit comments