1// run-rustfix 2 3#![warn(clippy::map_entry)] 4#![allow(dead_code)] 5 6use std::collections::BTreeMap; 7 8fn foo() {} 9 10fn 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 18fn main() {} 19