b717aa1b95
Mainly so that it is easier to only run all `non-snake-case`-specific tests but no other tests with: ./x test tests/ui/lint/non-snake-case But also to reduce the size of the large `tests/ui/lint` directory. And rename some tests to pass tidy, and remove them from `src/tools/tidy/src/issues.txt`.
30 lines
895 B
Rust
30 lines
895 B
Rust
#![deny(non_snake_case)]
|
|
#![allow(unused_variables)]
|
|
#![allow(dead_code)]
|
|
|
|
enum Foo {
|
|
Bad {
|
|
lowerCamelCaseName: bool,
|
|
//~^ ERROR structure field `lowerCamelCaseName` should have a snake case name
|
|
},
|
|
Good {
|
|
snake_case_name: bool,
|
|
},
|
|
}
|
|
|
|
fn main() {
|
|
let b = Foo::Bad { lowerCamelCaseName: true };
|
|
|
|
match b {
|
|
Foo::Bad { lowerCamelCaseName } => {}
|
|
Foo::Good { snake_case_name: lowerCamelCaseBinding } => { }
|
|
//~^ ERROR variable `lowerCamelCaseBinding` should have a snake case name
|
|
}
|
|
|
|
if let Foo::Good { snake_case_name: anotherLowerCamelCaseBinding } = b { }
|
|
//~^ ERROR variable `anotherLowerCamelCaseBinding` should have a snake case name
|
|
|
|
if let Foo::Bad { lowerCamelCaseName: yetAnotherLowerCamelCaseBinding } = b { }
|
|
//~^ ERROR variable `yetAnotherLowerCamelCaseBinding` should have a snake case name
|
|
}
|