]> git.lizzy.rs Git - rust.git/blob - tests/ui/enum_variants.rs
Merge branch 'master' into rustfmt_tests
[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
13 enum FakeCallType {
14     CALL,
15     CREATE,
16 }
17
18 enum FakeCallType2 {
19     CALL,
20     CREATELL,
21 }
22
23 enum Foo {
24     cFoo,
25     cBar,
26     cBaz,
27 }
28
29 enum Fooo {
30     cFoo, // no error, threshold is 3 variants by default
31     cBar,
32 }
33
34 enum Food {
35     FoodGood,
36     FoodMiddle,
37     FoodBad,
38 }
39
40 enum Stuff {
41     StuffBad, // no error
42 }
43
44 enum BadCallType {
45     CallTypeCall,
46     CallTypeCreate,
47     CallTypeDestroy,
48 }
49
50 enum TwoCallType {
51     // no error
52     CallTypeCall,
53     CallTypeCreate,
54 }
55
56 enum Consts {
57     ConstantInt,
58     ConstantCake,
59     ConstantLie,
60 }
61
62 enum Two {
63     // no error here
64     ConstantInt,
65     ConstantInfer,
66 }
67
68 enum Something {
69     CCall,
70     CCreate,
71     CCryogenize,
72 }
73
74 enum Seal {
75     With,
76     Without,
77 }
78
79 enum Seall {
80     With,
81     WithOut,
82     Withbroken,
83 }
84
85 enum Sealll {
86     With,
87     WithOut,
88 }
89
90 enum Seallll {
91     WithOutCake,
92     WithOutTea,
93     WithOut,
94 }
95
96 enum NonCaps {
97     Prefixçš„,
98     PrefixTea,
99     PrefixCake,
100 }
101
102 pub enum PubSeall {
103     WithOutCake,
104     WithOutTea,
105     WithOut,
106 }
107
108 #[allow(clippy::pub_enum_variant_names)]
109 mod allowed {
110     pub enum PubAllowed {
111         SomeThis,
112         SomeThat,
113         SomeOtherWhat,
114     }
115 }
116
117 // should not lint
118 enum Pat {
119     Foo,
120     Bar,
121     Path,
122 }
123
124 // should not lint
125 enum N {
126     Pos,
127     Neg,
128     Float,
129 }
130
131 fn main() {}