Skip to content

Commit bd5f563

Browse files
committed
clean -p: call get_many once.
1 parent a8997cb commit bd5f563

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cargo/ops/cargo_clean.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub fn clean(ws: &Workspace<'_>, opts: &CleanOptions<'_>) -> CargoResult<()> {
9191
// Doc tests produce no output.
9292

9393
// Get Packages for the specified specs.
94-
let mut packages = Vec::new();
94+
let mut pkg_ids = Vec::new();
9595
for spec_str in opts.spec.iter() {
9696
// Translate the spec to a Package.
9797
let spec = PackageIdSpec::parse(spec_str)?;
@@ -115,8 +115,9 @@ pub fn clean(ws: &Workspace<'_>, opts: &CleanOptions<'_>) -> CargoResult<()> {
115115
if matches.is_empty() {
116116
anyhow::bail!("package ID specification `{}` matched no packages", spec);
117117
}
118-
packages.extend(pkg_set.get_many(matches)?);
118+
pkg_ids.extend(matches);
119119
}
120+
let packages = pkg_set.get_many(pkg_ids)?;
120121

121122
for pkg in packages {
122123
let pkg_dir = format!("{}-*", pkg.name());

0 commit comments

Comments
 (0)