]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/patterns.fixed
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / patterns.fixed
CommitLineData
f20569fa 1// run-rustfix
f20569fa 2#![warn(clippy::all)]
2b03887a
FG
3#![allow(unused)]
4#![allow(clippy::uninlined_format_args)]
f20569fa
XL
5
6fn 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}