Skip to content

Commit

Permalink
Make a dependencies map while building feature map
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Apr 28, 2018
1 parent e357d17 commit 4966f53
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cargo/core/summary.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::BTreeMap;
use std::collections::{BTreeMap, HashMap};
use std::mem;
use std::rc::Rc;

Expand Down Expand Up @@ -133,6 +133,11 @@ fn build_feature_map(
dependencies: &[Dependency],
) -> CargoResult<FeatureMap> {
use self::FeatureValue::*;
let dep_map: HashMap<_, _> = dependencies
.iter()
.map(|d| (d.name().as_str(), d))
.collect();

let mut map = BTreeMap::new();
for (feature, list) in features.iter() {
let mut values = vec![];
Expand All @@ -148,7 +153,7 @@ fn build_feature_map(
match val {
Feature(_) => None,
Crate(ref dep_name) | CrateFeature(ref dep_name, _) => {
dependencies.iter().find(|d| d.name() == *dep_name)
dep_map.get(dep_name.as_str())
}
}
};
Expand Down

0 comments on commit 4966f53

Please sign in to comment.