]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/tests/ui/entry_fixable.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / ui / entry_fixable.rs
diff --git a/src/tools/clippy/tests/ui/entry_fixable.rs b/src/tools/clippy/tests/ui/entry_fixable.rs
new file mode 100644 (file)
index 0000000..55d5b21
--- /dev/null
@@ -0,0 +1,17 @@
+// run-rustfix
+
+#![allow(unused, clippy::needless_pass_by_value)]
+#![warn(clippy::map_entry)]
+
+use std::collections::{BTreeMap, HashMap};
+use std::hash::Hash;
+
+fn foo() {}
+
+fn insert_if_absent0<K: Eq + Hash, V>(m: &mut HashMap<K, V>, k: K, v: V) {
+    if !m.contains_key(&k) {
+        m.insert(k, v);
+    }
+}
+
+fn main() {}