mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +00:00
46 lines
1.9 KiB
Text
46 lines
1.9 KiB
Text
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
|
--> $DIR/entry.rs:23:5
|
|
|
|
|
23 | if !m.contains_key(&k) { m.insert(k, v); }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k).or_insert(v)`
|
|
|
|
|
= note: `-D clippy::map-entry` implied by `-D warnings`
|
|
|
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
|
--> $DIR/entry.rs:27:5
|
|
|
|
|
27 | if !m.contains_key(&k) { foo(); m.insert(k, v); }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
|
|
|
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
|
--> $DIR/entry.rs:31:5
|
|
|
|
|
31 | if !m.contains_key(&k) { m.insert(k, v) } else { None };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
|
|
|
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
|
--> $DIR/entry.rs:35:5
|
|
|
|
|
35 | if m.contains_key(&k) { None } else { m.insert(k, v) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
|
|
|
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
|
--> $DIR/entry.rs:39:5
|
|
|
|
|
39 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
|
|
|
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
|
--> $DIR/entry.rs:43:5
|
|
|
|
|
43 | if m.contains_key(&k) { None } else { foo(); m.insert(k, v) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
|
|
|
|
error: usage of `contains_key` followed by `insert` on a `BTreeMap`
|
|
--> $DIR/entry.rs:47:5
|
|
|
|
|
47 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
|
|
|
|
error: aborting due to 7 previous errors
|
|
|