]> git.lizzy.rs Git - rust.git/blob - src/test/ui/typeck/issue-91328.fixed
Move `{core,std}::stream::Stream` to `{core,std}::async_iter::AsyncIterator`.
[rust.git] / src / test / ui / typeck / issue-91328.fixed
1 // Regression test for issue #91328.
2
3 // run-rustfix
4
5 #![allow(dead_code)]
6
7 fn foo(r: Result<Vec<i32>, i32>) -> i32 {
8     match r.as_deref() {
9     //~^ HELP: consider using `as_deref` here
10         Ok([a, b]) => a + b,
11         //~^ ERROR: expected an array or slice
12         //~| NOTE: pattern cannot match with input type
13         _ => 42,
14     }
15 }
16
17 fn bar(o: Option<Vec<i32>>) -> i32 {
18     match o.as_deref() {
19     //~^ HELP: consider using `as_deref` here
20         Some([a, b]) => a + b,
21         //~^ ERROR: expected an array or slice
22         //~| NOTE: pattern cannot match with input type
23         _ => 42,
24     }
25 }
26
27 fn baz(v: Vec<i32>) -> i32 {
28     match v[..] {
29     //~^ HELP: consider slicing here
30         [a, b] => a + b,
31         //~^ ERROR: expected an array or slice
32         //~| NOTE: pattern cannot match with input type
33         _ => 42,
34     }
35 }
36
37 fn main() {}