fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.5 KiB62 linesraw
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,
10    //~^ ERROR: name `CWR` contains a capitalized acronym
11    //~| NOTE: `-D clippy::upper-case-acronyms` implied by `-D warnings`
12    Ece,
13    //~^ ERROR: name `ECE` contains a capitalized acronym
14    Urg,
15    //~^ ERROR: name `URG` contains a capitalized acronym
16    Ack,
17    //~^ ERROR: name `ACK` contains a capitalized acronym
18    Psh,
19    //~^ ERROR: name `PSH` contains a capitalized acronym
20    Rst,
21    //~^ ERROR: name `RST` contains a capitalized acronym
22    Syn,
23    //~^ ERROR: name `SYN` contains a capitalized acronym
24    Fin,
25    //~^ ERROR: name `FIN` contains a capitalized acronym
26}
27
28// linted with cfg option, beware that lint suggests `GccllvmSomething` instead of
29// `GccLlvmSomething`
30struct GCCLLVMSomething;
31
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),
46    //~^ ERROR: name `WASD` contains a capitalized acronym
47    Utf8(std::string::FromUtf8Error),
48    Parse(T, String),
49}
50
51// do lint here
52struct Json;
53//~^ ERROR: name `JSON` contains a capitalized acronym
54
55// do lint here
56enum Yaml {
57    //~^ ERROR: name `YAML` contains a capitalized acronym
58    Num(u32),
59    Str(String),
60}
61
62fn main() {}