]> git.proxmox.com Git - rustc.git/blob - tests/ui/lint/issue-66362-no-snake-case-warning-for-field-puns.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / lint / issue-66362-no-snake-case-warning-for-field-puns.rs
1 #![deny(non_snake_case)]
2 #![allow(unused_variables)]
3 #![allow(dead_code)]
4
5 enum Foo {
6 Bad {
7 lowerCamelCaseName: bool,
8 //~^ ERROR structure field `lowerCamelCaseName` should have a snake case name
9 },
10 Good {
11 snake_case_name: bool,
12 },
13 }
14
15 fn main() {
16 let b = Foo::Bad { lowerCamelCaseName: true };
17
18 match b {
19 Foo::Bad { lowerCamelCaseName } => {}
20 Foo::Good { snake_case_name: lowerCamelCaseBinding } => { }
21 //~^ ERROR variable `lowerCamelCaseBinding` should have a snake case name
22 }
23
24 if let Foo::Good { snake_case_name: anotherLowerCamelCaseBinding } = b { }
25 //~^ ERROR variable `anotherLowerCamelCaseBinding` should have a snake case name
26
27 if let Foo::Bad { lowerCamelCaseName: yetAnotherLowerCamelCaseBinding } = b { }
28 //~^ ERROR variable `yetAnotherLowerCamelCaseBinding` should have a snake case name
29 }