File tree 3 files changed +44
-1
lines changed
3 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ pub fn from(s: &str) -> usize {
55
55
}
56
56
} else if c. is_lowercase ( ) {
57
57
down = true ;
58
+ } else if c. is_uppercase ( ) {
59
+ last_i = i;
58
60
} else {
59
61
return last_i;
60
62
}
@@ -70,12 +72,16 @@ mod test {
70
72
fn from_full ( ) {
71
73
assert_eq ! ( from( "AbcDef" ) , 0 ) ;
72
74
assert_eq ! ( from( "Abc" ) , 0 ) ;
75
+ assert_eq ! ( from( "ABcd" ) , 0 ) ;
76
+ assert_eq ! ( from( "ABcdEf" ) , 0 ) ;
77
+ assert_eq ! ( from( "AabABcd" ) , 0 ) ;
73
78
}
74
79
75
80
#[ test]
76
81
fn from_partial ( ) {
77
82
assert_eq ! ( from( "abcDef" ) , 3 ) ;
78
83
assert_eq ! ( from( "aDbc" ) , 1 ) ;
84
+ assert_eq ! ( from( "aabABcd" ) , 3 ) ;
79
85
}
80
86
81
87
#[ test]
Original file line number Diff line number Diff line change @@ -133,4 +133,17 @@ pub enum NetworkLayer {
133
133
Layer3 ,
134
134
}
135
135
136
+ // should lint suggesting `IData`, not only `Data` (see #4639)
137
+ enum IDataRequest {
138
+ PutIData ( String ) ,
139
+ GetIData ( String ) ,
140
+ DeleteUnpubIData ( String ) ,
141
+ }
142
+
143
+ enum HIDataRequest {
144
+ PutHIData ( String ) ,
145
+ GetHIData ( String ) ,
146
+ DeleteUnpubHIData ( String ) ,
147
+ }
148
+
136
149
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -97,5 +97,29 @@ LL | | }
97
97
= note: `-D clippy::pub-enum-variant-names` implied by `-D warnings`
98
98
= help: remove the prefixes and use full paths to the variants instead of glob imports
99
99
100
- error: aborting due to 10 previous errors
100
+ error: all variants have the same postfix: `IData`
101
+ --> $DIR/enum_variants.rs:137:1
102
+ |
103
+ LL | / enum IDataRequest {
104
+ LL | | PutIData(String),
105
+ LL | | GetIData(String),
106
+ LL | | DeleteUnpubIData(String),
107
+ LL | | }
108
+ | |_^
109
+ |
110
+ = help: remove the postfixes and use full paths to the variants instead of glob imports
111
+
112
+ error: all variants have the same postfix: `HIData`
113
+ --> $DIR/enum_variants.rs:143:1
114
+ |
115
+ LL | / enum HIDataRequest {
116
+ LL | | PutHIData(String),
117
+ LL | | GetHIData(String),
118
+ LL | | DeleteUnpubHIData(String),
119
+ LL | | }
120
+ | |_^
121
+ |
122
+ = help: remove the postfixes and use full paths to the variants instead of glob imports
123
+
124
+ error: aborting due to 12 previous errors
101
125
You can’t perform that action at this time.
0 commit comments