]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/pattern-slice-vec.fixed
Rollup merge of #87759 - m-ou-se:linux-process-sealed, r=jyn514
[rust.git] / src / test / ui / suggestions / pattern-slice-vec.fixed
1 // Regression test for #87017.
2
3 // run-rustfix
4
5 fn main() {
6     fn foo() -> Vec<i32> { vec![1, 2, 3] }
7
8     if let [_, _, _] = foo()[..] {}
9     //~^ ERROR: expected an array or slice
10     //~| HELP: consider slicing here
11
12     if let [] = &foo()[..] {}
13     //~^ ERROR: expected an array or slice
14     //~| HELP: consider slicing here
15
16     if let [] = foo()[..] {}
17     //~^ ERROR: expected an array or slice
18     //~| HELP: consider slicing here
19
20     let v = vec![];
21     match &v[..] {
22     //~^ HELP: consider slicing here
23         [5] => {}
24         //~^ ERROR: expected an array or slice
25         _ => {}
26     }
27 }