summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/unneeded_wildcard_pattern.fixed
blob: 2eeba509e8338877b2897148b9d15bec952e9bc9 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//@run-rustfix
//@aux-build:proc_macros.rs:proc-macro
#![feature(stmt_expr_attributes)]
#![deny(clippy::unneeded_wildcard_pattern)]
#![allow(clippy::needless_if)]

#[macro_use]
extern crate proc_macros;

fn main() {
    let t = (0, 1, 2, 3);

    if let (0, ..) = t {};
    if let (0, ..) = t {};
    if let (.., 0) = t {};
    if let (.., 0) = t {};
    if let (0, ..) = t {};
    if let (0, ..) = t {};
    if let (_, 0, ..) = t {};
    if let (.., 0, _) = t {};
    if let (0, _, _, _) = t {};
    if let (0, ..) = t {};
    if let (.., 0) = t {};

    #[rustfmt::skip]
    {
        if let (0, ..,) = t {};
    }

    struct S(usize, usize, usize, usize);

    let s = S(0, 1, 2, 3);

    if let S(0, ..) = s {};
    if let S(0, ..) = s {};
    if let S(.., 0) = s {};
    if let S(.., 0) = s {};
    if let S(0, ..) = s {};
    if let S(0, ..) = s {};
    if let S(_, 0, ..) = s {};
    if let S(.., 0, _) = s {};
    if let S(0, _, _, _) = s {};
    if let S(0, ..) = s {};
    if let S(.., 0) = s {};

    #[rustfmt::skip]
    {
        if let S(0, ..,) = s {};
    }
    external! {
        let t = (0, 1, 2, 3);
        if let (0, _, ..) = t {};
    }
}