]> git.lizzy.rs Git - rust.git/blob - tests/ui/enum_variants.rs
Merge pull request #3285 from devonhollowood/pedantic-dogfood-items-after-statements
[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
11 #![feature(tool_lints)]
12
13 #![feature(non_ascii_idents)]
14
15 #![warn(clippy::all, clippy::pub_enum_variant_names)]
16
17 enum FakeCallType {
18     CALL, CREATE
19 }
20
21 enum FakeCallType2 {
22     CALL, CREATELL
23 }
24
25 enum Foo {
26     cFoo,
27     cBar,
28     cBaz,
29 }
30
31 enum Fooo {
32     cFoo, // no error, threshold is 3 variants by default
33     cBar,
34 }
35
36 enum Food {
37     FoodGood,
38     FoodMiddle,
39     FoodBad,
40 }
41
42 enum Stuff {
43     StuffBad, // no error
44 }
45
46 enum BadCallType {
47     CallTypeCall,
48     CallTypeCreate,
49     CallTypeDestroy,
50 }
51
52 enum TwoCallType { // no error
53     CallTypeCall,
54     CallTypeCreate,
55 }
56
57 enum Consts {
58     ConstantInt,
59     ConstantCake,
60     ConstantLie,
61 }
62
63 enum Two { // 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() {}