fix the actual bug

This commit is contained in:
J-ZhengLi 2024-02-24 00:35:48 +08:00
parent 0d83a3a18b
commit 929f746b5c
4 changed files with 50 additions and 41 deletions

View file

@ -217,3 +217,7 @@ fn issue_11958() {
// should not lint, `String` is not `Copy`
f(&vec!["test".to_owned(); 2]);
}
fn issue_12101() {
for a in &[1, 2] {}
}

View file

@ -217,3 +217,7 @@ fn issue_11958() {
// should not lint, `String` is not `Copy`
f(&vec!["test".to_owned(); 2]);
}
fn issue_12101() {
for a in &(vec![1, 2]) {}
}

View file

@ -121,5 +121,11 @@ error: useless use of `vec!`
LL | this_macro_doesnt_need_vec!(vec![1]);
| ^^^^^^^ help: you can use an array directly: `[1]`
error: aborting due to 20 previous errors
error: useless use of `vec!`
--> tests/ui/vec.rs:222:14
|
LL | for a in &(vec![1, 2]) {}
| ^^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]`
error: aborting due to 21 previous errors