]> git.proxmox.com Git - rustc.git/blob - src/test/ui/lint/lint-uppercase-variables.rs
Update upstream source from tag 'upstream/1.48.0_beta.8+dfsg1'
[rustc.git] / src / test / 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 //~^^ WARN `Foo` is named the same as one of the variants of the type `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 //~^^ WARN `Foo` is named the same as one of the variants of the type `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 //~^^ WARN `Foo` is named the same as one of the variants of the type `Foo`
36 //~^^^ WARN unused variable: `Foo`
37
38 test(1);
39
40 let _ = Something { X: 0 };
41 }