]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/upper_case_acronyms.rs
bump version to 1.81.0+dfsg1-2~bpo12+pve1
[rustc.git] / src / tools / clippy / tests / ui / upper_case_acronyms.rs
CommitLineData
f20569fa
XL
1#![warn(clippy::upper_case_acronyms)]
2
3struct HTTPResponse; // not linted by default, but with cfg option
4
5struct CString; // not linted
6
7enum 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`
30struct GCCLLVMSomething;
31
cdc7bbd5
XL
32// public items must not be linted
33pub struct NOWARNINGHERE;
34pub struct ALSONoWarningHERE;
35
36// enum variants should not be linted if the num is pub
37pub enum ParseError<T> {
38 YDB(u8),
39 Utf8(std::string::FromUtf8Error),
40 Parse(T, String),
41}
42
43// private, do lint here
44enum 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
52struct JSON;
781aab86 53//~^ ERROR: name `JSON` contains a capitalized acronym
2b03887a
FG
54
55// do lint here
56enum 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
63enum AllowOnField {
64 DISALLOW,
65 //~^ ERROR: name `DISALLOW` contains a capitalized acronym
66 #[allow(clippy::upper_case_acronyms)]
67 ALLOW,
68}
69
f20569fa 70fn main() {}