fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
922 B47 linesraw
1//@aux-build:proc_macros.rs
2#![warn(clippy::all)]
3#![allow(unused)]
4#![allow(clippy::uninlined_format_args)]
5
6#[macro_use]
7extern crate proc_macros;
8
9fn main() {
10    let v = Some(true);
11    let s = [0, 1, 2, 3, 4];
12    match v {
13        Some(x) => (),
14        y => (),
15    }
16    match v {
17        Some(x) => (),
18        y @ None => (), // no error
19    }
20    match s {
21        [x, inside @ .., y] => (), // no error
22        [..] => (),
23    }
24
25    let mut mutv = vec![1, 2, 3];
26
27    // required "ref" left out in suggestion: #5271
28    match mutv {
29        ref mut x => {
30            x.push(4);
31            println!("vec: {:?}", x);
32        },
33        ref y if y == &vec![0] => (),
34    }
35
36    match mutv {
37        ref x => println!("vec: {:?}", x),
38        ref y if y == &vec![0] => (),
39    }
40    external! {
41        let v = Some(true);
42        match v {
43            Some(x) => (),
44            y @ _ => (),
45        }
46    }
47}