]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | #![warn(clippy::upper_case_acronyms)] |
2 | ||
3 | struct HTTPResponse; // not linted by default, but with cfg option | |
4 | ||
5 | struct CString; // not linted | |
6 | ||
7 | enum Flags { | |
8 | NS, // not linted | |
9 | CWR, | |
781aab86 FG |
10 | //~^ ERROR: name `CWR` contains a capitalized acronym |
11 | //~| NOTE: `-D clippy::upper-case-acronyms` implied by `-D warnings` | |
f20569fa | 12 | ECE, |
781aab86 | 13 | //~^ ERROR: name `ECE` contains a capitalized acronym |
f20569fa | 14 | URG, |
781aab86 | 15 | //~^ ERROR: name `URG` contains a capitalized acronym |
f20569fa | 16 | ACK, |
781aab86 | 17 | //~^ ERROR: name `ACK` contains a capitalized acronym |
f20569fa | 18 | PSH, |
781aab86 | 19 | //~^ ERROR: name `PSH` contains a capitalized acronym |
f20569fa | 20 | RST, |
781aab86 | 21 | //~^ ERROR: name `RST` contains a capitalized acronym |
f20569fa | 22 | SYN, |
781aab86 | 23 | //~^ ERROR: name `SYN` contains a capitalized acronym |
f20569fa | 24 | FIN, |
781aab86 | 25 | //~^ ERROR: name `FIN` contains a capitalized acronym |
f20569fa XL |
26 | } |
27 | ||
28 | // linted with cfg option, beware that lint suggests `GccllvmSomething` instead of | |
29 | // `GccLlvmSomething` | |
30 | struct GCCLLVMSomething; | |
31 | ||
cdc7bbd5 XL |
32 | // public items must not be linted |
33 | pub struct NOWARNINGHERE; | |
34 | pub struct ALSONoWarningHERE; | |
35 | ||
36 | // enum variants should not be linted if the num is pub | |
37 | pub enum ParseError<T> { | |
38 | YDB(u8), | |
39 | Utf8(std::string::FromUtf8Error), | |
40 | Parse(T, String), | |
41 | } | |
42 | ||
43 | // private, do lint here | |
44 | enum ParseErrorPrivate<T> { | |
45 | WASD(u8), | |
781aab86 | 46 | //~^ ERROR: name `WASD` contains a capitalized acronym |
cdc7bbd5 XL |
47 | Utf8(std::string::FromUtf8Error), |
48 | Parse(T, String), | |
49 | } | |
50 | ||
2b03887a FG |
51 | // do lint here |
52 | struct JSON; | |
781aab86 | 53 | //~^ ERROR: name `JSON` contains a capitalized acronym |
2b03887a FG |
54 | |
55 | // do lint here | |
56 | enum YAML { | |
781aab86 | 57 | //~^ ERROR: name `YAML` contains a capitalized acronym |
2b03887a FG |
58 | Num(u32), |
59 | Str(String), | |
60 | } | |
61 | ||
4b012472 FG |
62 | // test for issue #7708 |
63 | enum AllowOnField { | |
64 | DISALLOW, | |
65 | //~^ ERROR: name `DISALLOW` contains a capitalized acronym | |
66 | #[allow(clippy::upper_case_acronyms)] | |
67 | ALLOW, | |
68 | } | |
69 | ||
f20569fa | 70 | fn main() {} |