2023-04-23 06:03:09 -05:00
|
|
|
//@run-rustfix
|
2021-09-08 09:31:47 -05:00
|
|
|
|
|
|
|
#![warn(clippy::map_entry)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
|
|
use std::collections::BTreeMap;
|
|
|
|
|
|
|
|
fn foo() {}
|
|
|
|
|
|
|
|
fn btree_map<K: Eq + Ord + Copy, V: Copy>(m: &mut BTreeMap<K, V>, k: K, v: V) {
|
|
|
|
// insert then do something, use if let
|
|
|
|
if !m.contains_key(&k) {
|
|
|
|
m.insert(k, v);
|
|
|
|
foo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|