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