error: usage of `contains_key` followed by `insert` on a `HashMap`
- --> $DIR/entry.rs:13:5
+ --> $DIR/entry.rs:10:5
|
-13 | if !m.contains_key(&k) { m.insert(k, v); }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / if !m.contains_key(&k) {
+LL | | m.insert(k, v);
+LL | | }
+ | |_____^ help: consider using: `m.entry(k).or_insert(v)`
|
-note: lint level defined here
- --> $DIR/entry.rs:5:9
- |
-5 | #![deny(map_entry)]
- | ^^^^^^^^^
-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:20:5
- |
-20 | if !m.contains_key(&k) { foo(); m.insert(k, v); }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ --> $DIR/entry.rs:16:5
|
-help: consider using
- | m.entry(k)
+LL | / if !m.contains_key(&k) {
+LL | | foo();
+LL | | m.insert(k, v);
+LL | | }
+ | |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
- --> $DIR/entry.rs:27:5
+ --> $DIR/entry.rs:23:5
|
-27 | if !m.contains_key(&k) { m.insert(k, v) } else { None };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: consider using
- | m.entry(k);
+LL | / if !m.contains_key(&k) {
+LL | | m.insert(k, v)
+LL | | } else {
+LL | | None
+LL | | };
+ | |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
- --> $DIR/entry.rs:34:5
- |
-34 | if m.contains_key(&k) { None } else { m.insert(k, v) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ --> $DIR/entry.rs:31:5
|
-help: consider using
- | m.entry(k);
+LL | / if m.contains_key(&k) {
+LL | | None
+LL | | } else {
+LL | | m.insert(k, v)
+LL | | };
+ | |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
- --> $DIR/entry.rs:41:5
+ --> $DIR/entry.rs:39:5
|
-41 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: consider using
- | m.entry(k);
+LL | / if !m.contains_key(&k) {
+LL | | foo();
+LL | | m.insert(k, v)
+LL | | } else {
+LL | | None
+LL | | };
+ | |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:48:5
|
-48 | if m.contains_key(&k) { None } else { foo(); m.insert(k, v) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: consider using
- | m.entry(k);
+LL | / if m.contains_key(&k) {
+LL | | None
+LL | | } else {
+LL | | foo();
+LL | | m.insert(k, v)
+LL | | };
+ | |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `BTreeMap`
- --> $DIR/entry.rs:55:5
- |
-55 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ --> $DIR/entry.rs:57:5
|
-help: consider using
- | m.entry(k);
+LL | / if !m.contains_key(&k) {
+LL | | foo();
+LL | | m.insert(k, v)
+LL | | } else {
+LL | | None
+LL | | };
+ | |_____^ help: consider using: `m.entry(k)`
error: aborting due to 7 previous errors