Simplify implied_target_features
.
Currently its argument is an iterator, but in practice it's always a singleton.
This commit is contained in:
parent
1df93fd6a7
commit
2df8e657f2
4 changed files with 10 additions and 12 deletions
|
@ -768,17 +768,15 @@ impl Target {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn implied_target_features<'a>(
|
||||
&self,
|
||||
base_features: impl Iterator<Item = &'a str>,
|
||||
) -> FxHashSet<&'a str> {
|
||||
// Note: the returned set includes `base_feature`.
|
||||
pub fn implied_target_features<'a>(&self, base_feature: &'a str) -> FxHashSet<&'a str> {
|
||||
let implied_features =
|
||||
self.rust_target_features().iter().map(|(f, _, i)| (f, i)).collect::<FxHashMap<_, _>>();
|
||||
|
||||
// implied target features have their own implied target features, so we traverse the
|
||||
// map until there are no more features to add
|
||||
// Implied target features have their own implied target features, so we traverse the
|
||||
// map until there are no more features to add.
|
||||
let mut features = FxHashSet::default();
|
||||
let mut new_features = base_features.collect::<Vec<&str>>();
|
||||
let mut new_features = vec![base_feature];
|
||||
while let Some(new_feature) = new_features.pop() {
|
||||
if features.insert(new_feature) {
|
||||
if let Some(implied_features) = implied_features.get(&new_feature) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue