]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/lint-non-snake-case-functions.rs
Auto merge of #106884 - clubby789:fieldless-enum-debug, r=michaelwoerister
[rust.git] / tests / ui / lint / lint-non-snake-case-functions.rs
1 #![deny(non_snake_case)]
2 #![allow(dead_code)]
3
4 struct Foo;
5
6 impl Foo {
7     fn Foo_Method() {}
8     //~^ ERROR method `Foo_Method` should have a snake case name
9
10     // Don't allow two underscores in a row
11     fn foo__method(&self) {}
12     //~^ ERROR method `foo__method` should have a snake case name
13
14     pub fn xyZ(&mut self) {}
15     //~^ ERROR method `xyZ` should have a snake case name
16
17     fn render_HTML() {}
18     //~^ ERROR method `render_HTML` should have a snake case name
19 }
20
21 trait X {
22     fn ABC();
23     //~^ ERROR trait method `ABC` should have a snake case name
24
25     fn a_b_C(&self) {}
26     //~^ ERROR trait method `a_b_C` should have a snake case name
27
28     fn something__else(&mut self);
29     //~^ ERROR trait method `something__else` should have a snake case name
30 }
31
32 impl X for Foo {
33     // These errors should be caught at the trait definition not the impl
34     fn ABC() {}
35     fn something__else(&mut self) {}
36 }
37
38 fn Cookie() {}
39 //~^ ERROR function `Cookie` should have a snake case name
40
41 pub fn bi_S_Cuit() {}
42 //~^ ERROR function `bi_S_Cuit` should have a snake case name
43
44 fn main() { }