diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/vec.fixed | 4 | ||||
| -rw-r--r-- | tests/ui/vec.rs | 4 | ||||
| -rw-r--r-- | tests/ui/vec.stderr | 8 |
3 files changed, 15 insertions, 1 deletions
diff --git a/tests/ui/vec.fixed b/tests/ui/vec.fixed index b318fd42f7c..9e755a82af4 100644 --- a/tests/ui/vec.fixed +++ b/tests/ui/vec.fixed @@ -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] {} +} diff --git a/tests/ui/vec.rs b/tests/ui/vec.rs index 08ad6efa37f..c483271438b 100644 --- a/tests/ui/vec.rs +++ b/tests/ui/vec.rs @@ -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]) {} +} diff --git a/tests/ui/vec.stderr b/tests/ui/vec.stderr index 6fd4748fff3..3faea8033fe 100644 --- a/tests/ui/vec.stderr +++ b/tests/ui/vec.stderr @@ -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 |
