Skip to content

Commit

Permalink
Merge pull request #3055 from rust-lang/revert-3054-simplify
Browse files Browse the repository at this point in the history
Revert "Replace for loop with iterators"
  • Loading branch information
alexcrichton authored Aug 29, 2016
2 parents 4f21500 + 2a9c467 commit 3e41b6b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/cargo/core/resolver/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,18 @@ impl EncodableResolve {
g
};

let replacements: HashMap<_, _> = try!(live_pkgs.values()
.filter_map(|&(ref id, pkg)| pkg.replace.as_ref().and_then(|replace| {
assert!(pkg.dependencies.is_none());
match lookup_id(replace) {
Err(e) => Some(Err(e)),
Ok(None) => None,
Ok(Some(replace)) => Some(Ok((id.clone(), replace)))
let replacements = {
let mut replacements = HashMap::new();
for &(ref id, ref pkg) in live_pkgs.values() {
if let Some(ref replace) = pkg.replace {
assert!(pkg.dependencies.is_none());
if let Some(replace_id) = try!(lookup_id(replace)) {
replacements.insert(id.clone(), replace_id);
}
}
})).collect());
}
replacements
};

let mut metadata = self.metadata.unwrap_or(BTreeMap::new());

Expand Down

0 comments on commit 3e41b6b

Please sign in to comment.