]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | // run-rustfix |
2 | #![allow(unused)] | |
3 | #![warn(clippy::all)] | |
4 | ||
5 | fn main() { | |
6 | let v = Some(true); | |
7 | let s = [0, 1, 2, 3, 4]; | |
8 | match v { | |
9 | Some(x) => (), | |
10 | y @ _ => (), | |
11 | } | |
12 | match v { | |
13 | Some(x) => (), | |
14 | y @ None => (), // no error | |
15 | } | |
16 | match s { | |
17 | [x, inside @ .., y] => (), // no error | |
18 | [..] => (), | |
19 | } | |
20 | ||
21 | let mut mutv = vec![1, 2, 3]; | |
22 | ||
23 | // required "ref" left out in suggestion: #5271 | |
24 | match mutv { | |
25 | ref mut x @ _ => { | |
26 | x.push(4); | |
27 | println!("vec: {:?}", x); | |
28 | }, | |
29 | ref y if y == &vec![0] => (), | |
30 | } | |
31 | ||
32 | match mutv { | |
33 | ref x @ _ => println!("vec: {:?}", x), | |
34 | ref y if y == &vec![0] => (), | |
35 | } | |
36 | } |