summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/redundant_at_rest_pattern.fixed
blob: 080cf13b5dac2b3064511e3169d1b3d67c7d239f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//@run-rustfix
//@aux-build:proc_macros.rs:proc-macro
#![allow(irrefutable_let_patterns, unused)]
#![warn(clippy::redundant_at_rest_pattern)]

#[macro_use]
extern crate proc_macros;

fn main() {
    if let a = [()] {}
    if let ref a = [()] {}
    if let mut a = [()] {}
    if let ref mut a = [()] {}
    let v = vec![()];
    if let a = &*v {}
    let s = &[()];
    if let a = s {}
    // Don't lint
    if let [..] = &*v {}
    if let [a] = &*v {}
    if let [()] = &*v {}
    if let [first, rest @ ..] = &*v {}
    if let a = [()] {}
    external! {
        if let [a @ ..] = [()] {}
    }
}