Skip to content

Commit

Permalink
Remove empty features everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
HadrienG2 committed Oct 23, 2023
1 parent cb1527a commit 20c9e8c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,19 @@ impl From<CheckRelease> for cargo_semver_checks::Check {
check.with_heuristically_included_features();
}
let mut mutual_features = value.features;
// Treat --features="" as a no-op like cargo does
if mutual_features == [""] {
mutual_features.clear();
}
let mut current_features = value.current_features;
let mut baseline_features = value.baseline_features;
current_features.append(&mut mutual_features.clone());
baseline_features.append(&mut mutual_features);
check.with_extra_features(current_features, baseline_features);

// Treat --features="" as a no-op like cargo does
let trim_features = |features: &mut Vec<String>| {
features.retain(|feature| !feature.is_empty());
};
trim_features(&mut current_features);
trim_features(&mut baseline_features);

check.with_extra_features(current_features, baseline_features);
check
}
}
Expand Down

0 comments on commit 20c9e8c

Please sign in to comment.