diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/tools/clippy/tests/ui/entry.stderr | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui/entry.stderr')
-rw-r--r-- | src/tools/clippy/tests/ui/entry.stderr | 217 |
1 files changed, 217 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/entry.stderr b/src/tools/clippy/tests/ui/entry.stderr new file mode 100644 index 000000000..2ef996652 --- /dev/null +++ b/src/tools/clippy/tests/ui/entry.stderr @@ -0,0 +1,217 @@ +error: usage of `contains_key` followed by `insert` on a `HashMap` + --> $DIR/entry.rs:24:5 + | +LL | / if !m.contains_key(&k) { +LL | | m.insert(k, v); +LL | | } + | |_____^ help: try this: `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:29:5 + | +LL | / if !m.contains_key(&k) { +LL | | if true { +LL | | m.insert(k, v); +LL | | } else { +LL | | m.insert(k, v2); +LL | | } +LL | | } + | |_____^ + | +help: try this + | +LL ~ m.entry(k).or_insert_with(|| { +LL + if true { +LL + v +LL + } else { +LL + v2 +LL + } +LL + }); + | + +error: usage of `contains_key` followed by `insert` on a `HashMap` + --> $DIR/entry.rs:38:5 + | +LL | / if !m.contains_key(&k) { +LL | | if true { +LL | | m.insert(k, v) +LL | | } else { +LL | | m.insert(k, v2) +LL | | }; +LL | | } + | |_____^ + | +help: try this + | +LL ~ m.entry(k).or_insert_with(|| { +LL + if true { +LL + v +LL + } else { +LL + v2 +LL + } +LL + }); + | + +error: usage of `contains_key` followed by `insert` on a `HashMap` + --> $DIR/entry.rs:47:5 + | +LL | / if !m.contains_key(&k) { +LL | | if true { +LL | | m.insert(k, v); +LL | | } else { +... | +LL | | } +LL | | } + | |_____^ + | +help: try this + | +LL ~ if let std::collections::hash_map::Entry::Vacant(e) = m.entry(k) { +LL + if true { +LL + e.insert(v); +LL + } else { +LL + e.insert(v2); +LL + return; +LL + } +LL + } + | + +error: usage of `contains_key` followed by `insert` on a `HashMap` + --> $DIR/entry.rs:57:5 + | +LL | / if !m.contains_key(&k) { +LL | | foo(); +LL | | m.insert(k, v); +LL | | } + | |_____^ + | +help: try this + | +LL ~ m.entry(k).or_insert_with(|| { +LL + foo(); +LL + v +LL + }); + | + +error: usage of `contains_key` followed by `insert` on a `HashMap` + --> $DIR/entry.rs:63:5 + | +LL | / if !m.contains_key(&k) { +LL | | match 0 { +LL | | 1 if true => { +LL | | m.insert(k, v); +... | +LL | | }; +LL | | } + | |_____^ + | +help: try this + | +LL ~ m.entry(k).or_insert_with(|| { +LL + match 0 { +LL + 1 if true => { +LL + v +LL + }, +LL + _ => { +LL + v2 +LL + }, +LL + } +LL + }); + | + +error: usage of `contains_key` followed by `insert` on a `HashMap` + --> $DIR/entry.rs:75:5 + | +LL | / if !m.contains_key(&k) { +LL | | match 0 { +LL | | 0 => foo(), +LL | | _ => { +... | +LL | | }; +LL | | } + | |_____^ + | +help: try this + | +LL ~ if let std::collections::hash_map::Entry::Vacant(e) = m.entry(k) { +LL + match 0 { +LL + 0 => foo(), +LL + _ => { +LL + e.insert(v2); +LL + }, +LL + }; +LL + } + | + +error: usage of `contains_key` followed by `insert` on a `HashMap` + --> $DIR/entry.rs:85:5 + | +LL | / if !m.contains_key(&k) { +LL | | foo(); +LL | | match 0 { +LL | | 0 if false => { +... | +LL | | } +LL | | } + | |_____^ + | +help: try this + | +LL ~ m.entry(k).or_insert_with(|| { +LL + foo(); +LL + match 0 { +LL + 0 if false => { +LL + v +LL + }, +LL + 1 => { +LL + foo(); +LL + v +LL + }, +LL + 2 | 3 => { +LL + for _ in 0..2 { +LL + foo(); +LL + } +LL + if true { +LL + v +LL + } else { +LL + v2 +LL + } +LL + }, +LL + _ => { +LL + v2 +LL + }, +LL + } +LL + }); + | + +error: usage of `contains_key` followed by `insert` on a `HashMap` + --> $DIR/entry.rs:119:5 + | +LL | / if !m.contains_key(&m!(k)) { +LL | | m.insert(m!(k), m!(v)); +LL | | } + | |_____^ help: try this: `m.entry(m!(k)).or_insert_with(|| m!(v));` + +error: usage of `contains_key` followed by `insert` on a `HashMap` + --> $DIR/entry.rs:151:5 + | +LL | / if !m.contains_key(&k) { +LL | | let x = (String::new(), String::new()); +LL | | let _ = x.0; +LL | | m.insert(k, v); +LL | | } + | |_____^ + | +help: try this + | +LL ~ m.entry(k).or_insert_with(|| { +LL + let x = (String::new(), String::new()); +LL + let _ = x.0; +LL + v +LL + }); + | + +error: aborting due to 10 previous errors + |