From 0b68cd7e00165056814e255aa0d14e61447f22f3 Mon Sep 17 00:00:00 2001 From: James Farrell Date: Tue, 19 Sep 2023 21:46:35 +0000 Subject: [PATCH] Ensure package IDs are unique when cleaning. get_many will panic if there are duplicate IDs. --- src/cargo/ops/cargo_clean.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cargo/ops/cargo_clean.rs b/src/cargo/ops/cargo_clean.rs index e05ffecba954..ac1b914d7469 100644 --- a/src/cargo/ops/cargo_clean.rs +++ b/src/cargo/ops/cargo_clean.rs @@ -9,6 +9,7 @@ use crate::util::{Config, Progress, ProgressStyle}; use anyhow::{bail, Context as _}; use cargo_util::paths; +use indexmap::IndexSet; use std::fs; use std::path::Path; @@ -104,7 +105,7 @@ pub fn clean(ws: &Workspace<'_>, opts: &CleanOptions<'_>) -> CargoResult<()> { // Doc tests produce no output. // Get Packages for the specified specs. - let mut pkg_ids = Vec::new(); + let mut pkg_ids = IndexSet::new(); for spec_str in opts.spec.iter() { // Translate the spec to a Package. let spec = PackageIdSpec::parse(spec_str)?;