File tree 3 files changed +25
-1
lines changed
3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -242,3 +242,12 @@ fn issue_12101() {
242
242
for a in &[1, 2] {}
243
243
//~^ useless_vec
244
244
}
245
+
246
+ fn issue_14531() {
247
+ // The lint used to suggest using an array rather than a reference to a slice.
248
+
249
+ fn requires_ref_slice(v: &[()]) {}
250
+ let v = &[];
251
+ //~^ useless_vec
252
+ requires_ref_slice(v);
253
+ }
Original file line number Diff line number Diff line change @@ -242,3 +242,12 @@ fn issue_12101() {
242
242
for a in & ( vec ! [ 1 , 2 ] ) { }
243
243
//~^ useless_vec
244
244
}
245
+
246
+ fn issue_14531 ( ) {
247
+ // The lint used to suggest using an array rather than a reference to a slice.
248
+
249
+ fn requires_ref_slice ( v : & [ ( ) ] ) { }
250
+ let v = & vec ! [ ] ;
251
+ //~^ useless_vec
252
+ requires_ref_slice ( v) ;
253
+ }
Original file line number Diff line number Diff line change @@ -127,5 +127,11 @@ error: useless use of `vec!`
127
127
LL | for a in &(vec![1, 2]) {}
128
128
| ^^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]`
129
129
130
- error: aborting due to 21 previous errors
130
+ error: useless use of `vec!`
131
+ --> tests/ui/vec.rs:250:13
132
+ |
133
+ LL | let v = &vec![];
134
+ | ^^^^^^^ help: you can use a slice directly: `&[]`
135
+
136
+ error: aborting due to 22 previous errors
131
137
You can’t perform that action at this time.
0 commit comments