]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/lint-uppercase-variables.rs
Rollup merge of #106946 - dtolnay:hashlinecolumn, r=m-ou-se
[rust.git] / tests / ui / lint / lint-uppercase-variables.rs
1 #![warn(unused)]
2 #![allow(dead_code)]
3 #![deny(non_snake_case)]
4
5 mod foo {
6     pub enum Foo { Foo }
7 }
8
9 struct Something {
10     X: usize //~ ERROR structure field `X` should have a snake case name
11 }
12
13 fn test(Xx: usize) { //~ ERROR variable `Xx` should have a snake case name
14     println!("{}", Xx);
15 }
16
17 fn main() {
18     let Test: usize = 0; //~ ERROR variable `Test` should have a snake case name
19     println!("{}", Test);
20
21     match foo::Foo::Foo {
22         Foo => {}
23     //~^ ERROR variable `Foo` should have a snake case name
24     //~^^ ERROR `Foo` is named the same as one of the variants of the type `foo::Foo`
25     //~^^^ WARN unused variable: `Foo`
26     }
27
28     let Foo = foo::Foo::Foo;
29     //~^ ERROR variable `Foo` should have a snake case name
30     //~^^ ERROR `Foo` is named the same as one of the variants of the type `foo::Foo`
31     //~^^^ WARN unused variable: `Foo`
32
33     fn in_param(Foo: foo::Foo) {}
34     //~^ ERROR variable `Foo` should have a snake case name
35     //~^^ ERROR `Foo` is named the same as one of the variants of the type `foo::Foo`
36     //~^^^ WARN unused variable: `Foo`
37
38     test(1);
39
40     let _ = Something { X: 0 };
41 }