]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/entry_btree.fixed
:arrow_up: rust-analyzer
[rust.git] / src / tools / clippy / tests / ui / entry_btree.fixed
1 // run-rustfix
2
3 #![warn(clippy::map_entry)]
4 #![allow(dead_code)]
5
6 use std::collections::BTreeMap;
7
8 fn foo() {}
9
10 fn btree_map<K: Eq + Ord + Copy, V: Copy>(m: &mut BTreeMap<K, V>, k: K, v: V) {
11     // insert then do something, use if let
12     if let std::collections::btree_map::Entry::Vacant(e) = m.entry(k) {
13         e.insert(v);
14         foo();
15     }
16 }
17
18 fn main() {}