mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 00:47:16 +00:00
17 lines
310 B
Rust
17 lines
310 B
Rust
|
#![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() {}
|