fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1#![warn(clippy::map_entry)] 2#![allow(dead_code)] 3 4use std::collections::BTreeMap; 5 6fn foo() {} 7 8fn btree_map<K: Eq + Ord + Copy, V: Copy>(m: &mut BTreeMap<K, V>, k: K, v: V) { 9 // insert then do something, use if let 10 if let std::collections::btree_map::Entry::Vacant(e) = m.entry(k) { 11 e.insert(v); 12 foo(); 13 } 14} 15 16fn main() {}