Skip to content

Commit 731ae05

Browse files
committed
Dedup the same version binaries
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
1 parent 397f446 commit 731ae05

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/bin/cargo/commands/install.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use cargo::util::IntoUrl;
99
use cargo::util::ToSemver;
1010
use cargo::util::VersionReqExt;
1111
use cargo::CargoResult;
12+
use itertools::Itertools;
1213
use semver::VersionReq;
1314

1415
use cargo_util::paths;
@@ -119,6 +120,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
119120
.get_many::<CrateVersion>("crate")
120121
.unwrap_or_default()
121122
.cloned()
123+
.dedup_by(|x, y| x == y)
122124
.map(|(krate, local_version)| resolve_crate(krate, local_version, version))
123125
.collect::<crate::CargoResult<Vec<_>>>()?;
124126

tests/testsuite/install.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ fn install_the_same_version_twice() {
7272
[FINISHED] release [optimized] target(s) in [..]
7373
[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
7474
[INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`)
75-
[INSTALLING] foo v0.0.1
76-
[COMPILING] foo v0.0.1
77-
[FINISHED] release [optimized] target(s) in [..]
78-
[REPLACING] [CWD]/home/.cargo/bin/foo[EXE]
79-
[REPLACED] package `foo v0.0.1` with `foo v0.0.1` (executable `foo[EXE]`)
80-
Summary Successfully installed foo, foo!
8175
[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
8276
",
8377
)

0 commit comments

Comments
 (0)