From 95b3e27449feda89699023fc59d359ff1e755837 Mon Sep 17 00:00:00 2001 From: Gabriel de Perthuis Date: Mon, 27 May 2024 21:48:05 +0200 Subject: [PATCH] Don't enforce the dep_spec source matching the resolved source With [patch] sections, this may not be the case. --- src/search_unused.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/search_unused.rs b/src/search_unused.rs index 590d4be..d365c83 100644 --- a/src/search_unused.rs +++ b/src/search_unused.rs @@ -382,10 +382,10 @@ pub(crate) fn find_unused( .expect( "resolved dependencies should appear under cargo-metadata packages", ); - let mut dep_spec_it = root_package.dependencies.iter().filter(|dep_spec| { - dep_spec.name == dep_pkg.name - && dep_spec.source.as_ref() == dep_pkg.source.as_ref().map(|s| &s.repr) - }); + let mut dep_spec_it = root_package + .dependencies + .iter() + .filter(|dep_spec| dep_spec.name == dep_pkg.name); // The dependency can appear more than once, for example if it is both // a dependency and a dev-dependency (often with more features enabled). // We'll assume cargo enforces consistency.