Skip to content

Commit 38c8ce6

Browse files
committed
Auto merge of #9616 - danieleades:refactor/unnecessary-collect, r=alexcrichton
remove unnecessary 'collect' would appreciate a review of this one, as i'm not sure the terminology i've used here is ideal... but you get the drift. no need to allocate a vector here.
2 parents 197e657 + 592b01c commit 38c8ce6

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/cargo/core/features.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -841,16 +841,13 @@ impl CliUnstable {
841841
// some point, and migrate to a new -Z flag for any future
842842
// things.
843843
let feats = parse_features(v);
844-
let stab: Vec<_> = feats
845-
.iter()
846-
.filter(|feat| {
847-
matches!(
848-
feat.as_str(),
849-
"build_dep" | "host_dep" | "dev_dep" | "itarget" | "all"
850-
)
851-
})
852-
.collect();
853-
if !stab.is_empty() || feats.is_empty() {
844+
let stab_is_not_empty = feats.iter().any(|feat| {
845+
matches!(
846+
feat.as_str(),
847+
"build_dep" | "host_dep" | "dev_dep" | "itarget" | "all"
848+
)
849+
});
850+
if stab_is_not_empty || feats.is_empty() {
854851
// Make this stabilized_err once -Zfeature support is removed.
855852
stabilized_warn(k, "1.51", STABILIZED_FEATURES);
856853
}

0 commit comments

Comments
 (0)