]> git.lizzy.rs Git - rust.git/blob - tests/ui/unneeded_wildcard_pattern.rs
Add `unneeded-wildcard-pattern` lint
[rust.git] / tests / ui / unneeded_wildcard_pattern.rs
1 // run-rustfix
2 #![feature(stmt_expr_attributes)]
3 #![deny(clippy::unneeded_wildcard_pattern)]
4
5 fn main() {
6     let t = (0, 1, 2, 3);
7
8     if let (0, .., _) = t {};
9     if let (0, _, ..) = t {};
10     if let (0, _, _, ..) = t {};
11     if let (0, .., _, _) = t {};
12     if let (_, 0, ..) = t {};
13     if let (.., 0, _) = t {};
14     if let (0, _, _, _) = t {};
15     if let (0, ..) = t {};
16     if let (.., 0) = t {};
17
18     #[rustfmt::skip]
19     {
20         if let (0, .., _, _,) = t {};
21     }
22
23     struct S(usize, usize, usize, usize);
24
25     let s = S(0, 1, 2, 3);
26
27     if let S(0, .., _) = s {};
28     if let S(0, _, ..) = s {};
29     if let S(0, _, _, ..) = s {};
30     if let S(0, .., _, _) = s {};
31     if let S(_, 0, ..) = s {};
32     if let S(.., 0, _) = s {};
33     if let S(0, _, _, _) = s {};
34     if let S(0, ..) = s {};
35     if let S(.., 0) = s {};
36
37     #[rustfmt::skip]
38     {
39         if let S(0, .., _, _,) = s {};
40     }
41 }