]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/many_single_char_names.rs
Rollup merge of #102625 - Rageking8:fix-backtrace-small-typo, r=m-ou-se
[rust.git] / src / tools / clippy / tests / ui / many_single_char_names.rs
1 #![allow(clippy::too_many_arguments, clippy::diverging_sub_expression)]
2 #![warn(clippy::many_single_char_names)]
3
4 fn bla() {
5     let a: i32;
6     let (b, c, d): (i32, i64, i16);
7     {
8         {
9             let cdefg: i32;
10             let blar: i32;
11         }
12         {
13             let e: i32;
14         }
15         {
16             let e: i32;
17             let f: i32;
18         }
19         match 5 {
20             1 => println!(),
21             e => panic!(),
22         }
23         match 5 {
24             1 => println!(),
25             _ => panic!(),
26         }
27     }
28 }
29
30 fn bindings(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) {}
31
32 fn bindings2() {
33     let (a, b, c, d, e, f, g, h): (bool, bool, bool, bool, bool, bool, bool, bool) = unimplemented!();
34 }
35
36 fn shadowing() {
37     let a = 0i32;
38     let a = 0i32;
39     let a = 0i32;
40     let a = 0i32;
41     let a = 0i32;
42     let a = 0i32;
43     {
44         let a = 0i32;
45     }
46 }
47
48 fn patterns() {
49     enum Z {
50         A(i32),
51         B(i32),
52         C(i32),
53         D(i32),
54         E(i32),
55         F(i32),
56     }
57
58     // These should not trigger a warning, since the pattern bindings are a new scope.
59     match Z::A(0) {
60         Z::A(a) => {},
61         Z::B(b) => {},
62         Z::C(c) => {},
63         Z::D(d) => {},
64         Z::E(e) => {},
65         Z::F(f) => {},
66     }
67 }
68
69 #[allow(clippy::many_single_char_names)]
70 fn issue_3198_allow_works() {
71     let (a, b, c, d, e) = (0, 0, 0, 0, 0);
72 }
73
74 fn main() {}