Use HashMap entry APIs more
This commit is contained in:
@@ -526,8 +526,9 @@ impl DropRangesBuilder {
|
|||||||
let mut next = <_>::from(0u32);
|
let mut next = <_>::from(0u32);
|
||||||
for value in tracked_values {
|
for value in tracked_values {
|
||||||
for_each_consumable(hir, value, |value| {
|
for_each_consumable(hir, value, |value| {
|
||||||
if !tracked_value_map.contains_key(&value) {
|
if let std::collections::hash_map::Entry::Vacant(e) = tracked_value_map.entry(value)
|
||||||
tracked_value_map.insert(value, next);
|
{
|
||||||
|
e.insert(next);
|
||||||
next = next + 1;
|
next = next + 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -266,12 +266,12 @@ impl LintLevelsProvider for QueryMapExpectationsWrapper<'_> {
|
|||||||
let LintExpectationId::Stable { attr_id: Some(attr_id), hir_id, attr_index, .. } = id else { bug!("unstable expectation id should already be mapped") };
|
let LintExpectationId::Stable { attr_id: Some(attr_id), hir_id, attr_index, .. } = id else { bug!("unstable expectation id should already be mapped") };
|
||||||
let key = LintExpectationId::Unstable { attr_id, lint_index: None };
|
let key = LintExpectationId::Unstable { attr_id, lint_index: None };
|
||||||
|
|
||||||
if !self.unstable_to_stable_ids.contains_key(&key) {
|
self.unstable_to_stable_ids.entry(key).or_insert(LintExpectationId::Stable {
|
||||||
self.unstable_to_stable_ids.insert(
|
hir_id,
|
||||||
key,
|
attr_index,
|
||||||
LintExpectationId::Stable { hir_id, attr_index, lint_index: None, attr_id: None },
|
lint_index: None,
|
||||||
);
|
attr_id: None,
|
||||||
}
|
});
|
||||||
|
|
||||||
self.expectations.push((id.normalize(), expectation));
|
self.expectations.push((id.normalize(), expectation));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user