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