summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/ref_patterns.rs
blob: acd42ec89b62f232d61550c438e363fd653e23e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#![allow(unused)]
#![warn(clippy::ref_patterns)]

fn use_in_pattern() {
    let opt = Some(5);
    match opt {
        None => {},
        Some(ref opt) => {},
        //~^ ERROR: usage of ref pattern
    }
}

fn use_in_binding() {
    let x = 5;
    let ref y = x;
    //~^ ERROR: usage of ref pattern
}

fn use_in_parameter(ref x: i32) {}
//~^ ERROR: usage of ref pattern

fn main() {}