2021-08-01 17:39:56 -05:00
|
|
|
error: usage of `contains_key` followed by `insert` on a `BTreeMap`
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/entry_btree.rs:10:5
|
2021-08-01 17:39:56 -05:00
|
|
|
|
|
|
|
|
LL | / if !m.contains_key(&k) {
|
|
|
|
LL | | m.insert(k, v);
|
|
|
|
LL | | foo();
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= note: `-D clippy::map-entry` implied by `-D warnings`
|
2023-07-01 06:08:01 -05:00
|
|
|
help: try
|
2021-08-01 17:39:56 -05:00
|
|
|
|
|
|
|
|
LL ~ if let std::collections::btree_map::Entry::Vacant(e) = m.entry(k) {
|
|
|
|
LL + e.insert(v);
|
|
|
|
LL + foo();
|
|
|
|
LL + }
|
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|