rust/tests/ui/entry_btree.stderr

21 lines
477 B
Plaintext
Raw Normal View History

error: usage of `contains_key` followed by `insert` on a `BTreeMap`
--> $DIR/entry_btree.rs:12:5
|
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
|
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