mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Add test case from #10488
This commit is contained in:
parent
008ba7326b
commit
3d711455c2
2 changed files with 19 additions and 7 deletions
|
@ -84,12 +84,18 @@ fn shadowing_2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::let_unit_value)]
|
#[allow(clippy::let_unit_value)]
|
||||||
fn fake_read() {
|
fn fake_read_1() {
|
||||||
let mut x = vec![1, 2, 3]; // WARNING
|
let mut x = vec![1, 2, 3]; // WARNING
|
||||||
x.reverse();
|
x.reverse();
|
||||||
let _: () = x.clear();
|
let _: () = x.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn fake_read_2() {
|
||||||
|
let mut x = vec![1, 2, 3]; // WARNING
|
||||||
|
x.reverse();
|
||||||
|
println!("{:?}", x.push(5));
|
||||||
|
}
|
||||||
|
|
||||||
fn assignment() {
|
fn assignment() {
|
||||||
let mut x = vec![1, 2, 3]; // WARNING
|
let mut x = vec![1, 2, 3]; // WARNING
|
||||||
let y = vec![4, 5, 6]; // Ok
|
let y = vec![4, 5, 6]; // Ok
|
||||||
|
|
|
@ -37,34 +37,40 @@ LL | let mut x = vec![1, 2, 3]; // WARNING
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: collection is never read
|
error: collection is never read
|
||||||
--> $DIR/collection_is_never_read.rs:101:5
|
--> $DIR/collection_is_never_read.rs:100:5
|
||||||
|
|
|
|
||||||
LL | let mut x = vec![1, 2, 3]; // WARNING
|
LL | let mut x = vec![1, 2, 3]; // WARNING
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: collection is never read
|
error: collection is never read
|
||||||
--> $DIR/collection_is_never_read.rs:118:5
|
--> $DIR/collection_is_never_read.rs:107:5
|
||||||
|
|
|
||||||
|
LL | let mut x = vec![1, 2, 3]; // WARNING
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: collection is never read
|
||||||
|
--> $DIR/collection_is_never_read.rs:124:5
|
||||||
|
|
|
|
||||||
LL | let mut x = HashSet::new(); // WARNING
|
LL | let mut x = HashSet::new(); // WARNING
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: collection is never read
|
error: collection is never read
|
||||||
--> $DIR/collection_is_never_read.rs:132:5
|
--> $DIR/collection_is_never_read.rs:138:5
|
||||||
|
|
|
|
||||||
LL | let x = vec![1, 2, 3]; // WARNING
|
LL | let x = vec![1, 2, 3]; // WARNING
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: collection is never read
|
error: collection is never read
|
||||||
--> $DIR/collection_is_never_read.rs:168:5
|
--> $DIR/collection_is_never_read.rs:174:5
|
||||||
|
|
|
|
||||||
LL | let mut s = String::new();
|
LL | let mut s = String::new();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: collection is never read
|
error: collection is never read
|
||||||
--> $DIR/collection_is_never_read.rs:181:5
|
--> $DIR/collection_is_never_read.rs:187:5
|
||||||
|
|
|
|
||||||
LL | let mut s = String::from("Hello, World!");
|
LL | let mut s = String::from("Hello, World!");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 11 previous errors
|
error: aborting due to 12 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue