about summary refs log tree commit diff
path: root/compiler/rustc_lint
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-04-09 21:53:03 +0200
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-04-09 21:59:28 +0200
commit54e1309c65ec10bb40adf832d2dee3e043dddb9c (patch)
treef61c5b976450f60ac39ea62dabee96fc4538cf52 /compiler/rustc_lint
parentf058d05fc20a19c46a8253eec15faa2636ea1135 (diff)
downloadrust-54e1309c65ec10bb40adf832d2dee3e043dddb9c.tar.gz
rust-54e1309c65ec10bb40adf832d2dee3e043dddb9c.zip
Use HashMap entry APIs more
Diffstat (limited to 'compiler/rustc_lint')
-rw-r--r--compiler/rustc_lint/src/levels.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs
index a76229dd352..a2a7c93a7ca 100644
--- a/compiler/rustc_lint/src/levels.rs
+++ b/compiler/rustc_lint/src/levels.rs
@@ -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 key = LintExpectationId::Unstable { attr_id, lint_index: None };
 
-        if !self.unstable_to_stable_ids.contains_key(&key) {
-            self.unstable_to_stable_ids.insert(
-                key,
-                LintExpectationId::Stable { hir_id, attr_index, lint_index: None, attr_id: None },
-            );
-        }
+        self.unstable_to_stable_ids.entry(key).or_insert(LintExpectationId::Stable {
+            hir_id,
+            attr_index,
+            lint_index: None,
+            attr_id: None,
+        });
 
         self.expectations.push((id.normalize(), expectation));
     }