]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/lint-group-style.rs
b2e6072c9855c38f93db02865e105befb2be182f
[rust.git] / src / test / compile-fail / lint-group-style.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![deny(bad_style)]
12 //~^ NOTE lint level defined here
13 #![allow(dead_code)]
14
15 fn CamelCase() {} //~ ERROR function `CamelCase` should have a snake case name
16
17 #[allow(bad_style)]
18 mod test {
19     fn CamelCase() {}
20
21     #[forbid(bad_style)]
22     //~^ NOTE lint level defined here
23     //~^^ NOTE lint level defined here
24     mod bad {
25         fn CamelCase() {} //~ ERROR function `CamelCase` should have a snake case name
26
27         static bad: isize = 1; //~ ERROR static variable `bad` should have an upper case name
28     }
29
30     mod warn {
31         #![warn(bad_style)]
32         //~^ NOTE lint level defined here
33         //~| NOTE lint level defined here
34
35         fn CamelCase() {} //~ WARN function `CamelCase` should have a snake case name
36
37         struct snake_case; //~ WARN type `snake_case` should have a camel case name
38     }
39 }
40
41 fn main() {}