]> git.lizzy.rs Git - rust.git/blob - tests/ui/enum_variants.rs
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / enum_variants.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 #![feature(non_ascii_idents)]
11 #![warn(clippy::all, clippy::pub_enum_variant_names)]
12 #![allow(non_camel_case_types)]
13
14 enum FakeCallType {
15     CALL,
16     CREATE,
17 }
18
19 enum FakeCallType2 {
20     CALL,
21     CREATELL,
22 }
23
24 enum Foo {
25     cFoo,
26     cBar,
27     cBaz,
28 }
29
30 enum Fooo {
31     cFoo, // no error, threshold is 3 variants by default
32     cBar,
33 }
34
35 enum Food {
36     FoodGood,
37     FoodMiddle,
38     FoodBad,
39 }
40
41 enum Stuff {
42     StuffBad, // no error
43 }
44
45 enum BadCallType {
46     CallTypeCall,
47     CallTypeCreate,
48     CallTypeDestroy,
49 }
50
51 enum TwoCallType {
52     // no error
53     CallTypeCall,
54     CallTypeCreate,
55 }
56
57 enum Consts {
58     ConstantInt,
59     ConstantCake,
60     ConstantLie,
61 }
62
63 enum Two {
64     // no error here
65     ConstantInt,
66     ConstantInfer,
67 }
68
69 enum Something {
70     CCall,
71     CCreate,
72     CCryogenize,
73 }
74
75 enum Seal {
76     With,
77     Without,
78 }
79
80 enum Seall {
81     With,
82     WithOut,
83     Withbroken,
84 }
85
86 enum Sealll {
87     With,
88     WithOut,
89 }
90
91 enum Seallll {
92     WithOutCake,
93     WithOutTea,
94     WithOut,
95 }
96
97 enum NonCaps {
98     Prefixçš„,
99     PrefixTea,
100     PrefixCake,
101 }
102
103 pub enum PubSeall {
104     WithOutCake,
105     WithOutTea,
106     WithOut,
107 }
108
109 #[allow(clippy::pub_enum_variant_names)]
110 mod allowed {
111     pub enum PubAllowed {
112         SomeThis,
113         SomeThat,
114         SomeOtherWhat,
115     }
116 }
117
118 // should not lint
119 enum Pat {
120     Foo,
121     Bar,
122     Path,
123 }
124
125 // should not lint
126 enum N {
127     Pos,
128     Neg,
129     Float,
130 }
131
132 fn main() {}