]> git.lizzy.rs Git - rust.git/blob - tests/ui/patterns.fixed
Move MSRV tests into the lint specific test files
[rust.git] / tests / ui / patterns.fixed
1 // run-rustfix
2 #![warn(clippy::all)]
3 #![allow(unused)]
4 #![allow(clippy::uninlined_format_args)]
5
6 fn main() {
7     let v = Some(true);
8     let s = [0, 1, 2, 3, 4];
9     match v {
10         Some(x) => (),
11         y => (),
12     }
13     match v {
14         Some(x) => (),
15         y @ None => (), // no error
16     }
17     match s {
18         [x, inside @ .., y] => (), // no error
19         [..] => (),
20     }
21
22     let mut mutv = vec![1, 2, 3];
23
24     // required "ref" left out in suggestion: #5271
25     match mutv {
26         ref mut x => {
27             x.push(4);
28             println!("vec: {:?}", x);
29         },
30         ref y if y == &vec![0] => (),
31     }
32
33     match mutv {
34         ref x => println!("vec: {:?}", x),
35         ref y if y == &vec![0] => (),
36     }
37 }