From: Eh2406 Date: Tue, 27 Feb 2018 02:46:59 +0000 (-0500) Subject: one more use of entry X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~75^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1ef675ef6e28a2d7e5c686b08890ddd8276da7f5;p=cargo.git one more use of entry --- diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index bb0e60404..a57695eb1 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -576,7 +576,11 @@ impl RemainingCandidates { } } - fn next(&mut self, prev_active: &[Summary], links: &HashMap) -> Result<(Candidate, bool), HashMap> { + fn next( + &mut self, + prev_active: &[Summary], + links: &HashMap, + ) -> Result<(Candidate, bool), HashMap> { // Filter the set of candidates based on the previously activated // versions for this dependency. We can actually use a version if it // precisely matches an activated version or if it is otherwise @@ -594,8 +598,10 @@ impl RemainingCandidates { if let Some(link) = b.summary.links() { if let Some(a) = links.get(link) { if a != b.summary.package_id() { - self.conflicting_prev_active.insert(a.clone(), ConflictReason::Links(link.to_owned())); - continue + self.conflicting_prev_active + .entry(a.clone()) + .or_insert_with(|| ConflictReason::Links(link.to_owned())); + continue; } } } @@ -604,7 +610,9 @@ impl RemainingCandidates { .find(|a| compatible(a.version(), b.summary.version())) { if *a != b.summary { - self.conflicting_prev_active.insert(a.package_id().clone(), ConflictReason::Semver); + self.conflicting_prev_active + .entry(a.package_id().clone()) + .or_insert(ConflictReason::Semver); continue; } }