Skip to content

Commit 93c5821

Browse files
committed
Restore enum_variant test
1 parent e212667 commit 93c5821

File tree

1 file changed

+148
-4
lines changed

1 file changed

+148
-4
lines changed

tests/ui/enum_variants.rs

Lines changed: 148 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,154 @@
11
#![warn(clippy::enum_variant_names)]
22
#![allow(non_camel_case_types, clippy::upper_case_acronyms)]
33

4-
enum _E {
5-
Nosrmal,
6-
NosLeft,
7-
NosRight,
4+
enum FakeCallType {
5+
CALL,
6+
CREATE,
7+
}
8+
9+
enum FakeCallType2 {
10+
CALL,
11+
CREATELL,
12+
}
13+
14+
enum Foo {
15+
cFoo,
16+
cBar,
17+
cBaz,
18+
}
19+
20+
enum Fooo {
21+
cFoo, // no error, threshold is 3 variants by default
22+
cBar,
23+
}
24+
25+
enum Food {
26+
FoodGood,
27+
FoodMiddle,
28+
FoodBad,
29+
}
30+
31+
enum Stuff {
32+
StuffBad, // no error
33+
}
34+
35+
enum BadCallType {
36+
CallTypeCall,
37+
CallTypeCreate,
38+
CallTypeDestroy,
39+
}
40+
41+
enum TwoCallType {
42+
// no error
43+
CallTypeCall,
44+
CallTypeCreate,
45+
}
46+
47+
enum Consts {
48+
ConstantInt,
49+
ConstantCake,
50+
ConstantLie,
51+
}
52+
53+
enum Two {
54+
// no error here
55+
ConstantInt,
56+
ConstantInfer,
57+
}
58+
59+
enum Something {
60+
CCall,
61+
CCreate,
62+
CCryogenize,
63+
}
64+
65+
enum Seal {
66+
With,
67+
Without,
68+
}
69+
70+
enum Seall {
71+
With,
72+
WithOut,
73+
Withbroken,
74+
}
75+
76+
enum Sealll {
77+
With,
78+
WithOut,
79+
}
80+
81+
enum Seallll {
82+
WithOutCake,
83+
WithOutTea,
84+
WithOut,
85+
}
86+
87+
enum NonCaps {
88+
Prefix的,
89+
PrefixTea,
90+
PrefixCake,
91+
}
92+
93+
pub enum PubSeall {
94+
WithOutCake,
95+
WithOutTea,
96+
WithOut,
97+
}
98+
99+
#[allow(clippy::enum_variant_names)]
100+
pub mod allowed {
101+
pub enum PubAllowed {
102+
SomeThis,
103+
SomeThat,
104+
SomeOtherWhat,
105+
}
106+
}
107+
108+
// should not lint
109+
enum Pat {
110+
Foo,
111+
Bar,
112+
Path,
113+
}
114+
115+
// should not lint
116+
enum N {
117+
Pos,
118+
Neg,
119+
Float,
120+
}
121+
122+
// should not lint
123+
enum Peek {
124+
Peek1,
125+
Peek2,
126+
Peek3,
127+
}
128+
129+
// should not lint
130+
pub enum NetworkLayer {
131+
Layer2,
132+
Layer3,
133+
}
134+
135+
// should lint suggesting `IData`, not only `Data` (see #4639)
136+
enum IDataRequest {
137+
PutIData(String),
138+
GetIData(String),
139+
DeleteUnpubIData(String),
140+
}
141+
142+
enum HIDataRequest {
143+
PutHIData(String),
144+
GetHIData(String),
145+
DeleteUnpubHIData(String),
146+
}
147+
148+
enum North {
149+
Normal,
150+
NoLeft,
151+
NoRight,
8152
}
9153

10154
fn main() {}

0 commit comments

Comments
 (0)