diff --git a/src/cargo/sources/path.rs b/src/cargo/sources/path.rs index 4f49171506e7..ce30af010834 100644 --- a/src/cargo/sources/path.rs +++ b/src/cargo/sources/path.rs @@ -323,6 +323,7 @@ impl<'gctx> Source for RecursivePathSource<'gctx> { for s in self .packages .iter() + .filter(|(pkg_id, _)| pkg_id.name() == dep.package_name()) .map(|(pkg_id, pkgs)| { first_package(*pkg_id, pkgs, &mut self.warned_duplicate, self.gctx) }) diff --git a/tests/testsuite/git.rs b/tests/testsuite/git.rs index 4232704b803d..eee527956222 100644 --- a/tests/testsuite/git.rs +++ b/tests/testsuite/git.rs @@ -1284,10 +1284,6 @@ expected `.`, `]` 2 | [package | ^ | -[WARNING] skipping duplicate package `duplicate v0.5.0 ([ROOTURL]/dep#[..])`: - [ROOT]/home/.cargo/git/checkouts/dep-[HASH]/[..]/duplicate2/Cargo.toml -in favor of [ROOT]/home/.cargo/git/checkouts/dep-[HASH]/[..]/duplicate1/Cargo.toml - [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s [RUNNING] `target/debug/foo[EXE]`