File tree Expand file tree Collapse file tree 3 files changed +44
-1
lines changed Expand file tree Collapse file tree 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 {
5555 }
5656 } else if c. is_lowercase ( ) {
5757 down = true ;
58+ } else if c. is_uppercase ( ) {
59+ last_i = i;
5860 } else {
5961 return last_i;
6062 }
@@ -70,12 +72,16 @@ mod test {
7072 fn from_full ( ) {
7173 assert_eq ! ( from( "AbcDef" ) , 0 ) ;
7274 assert_eq ! ( from( "Abc" ) , 0 ) ;
75+ assert_eq ! ( from( "ABcd" ) , 0 ) ;
76+ assert_eq ! ( from( "ABcdEf" ) , 0 ) ;
77+ assert_eq ! ( from( "AabABcd" ) , 0 ) ;
7378 }
7479
7580 #[ test]
7681 fn from_partial ( ) {
7782 assert_eq ! ( from( "abcDef" ) , 3 ) ;
7883 assert_eq ! ( from( "aDbc" ) , 1 ) ;
84+ assert_eq ! ( from( "aabABcd" ) , 3 ) ;
7985 }
8086
8187 #[ test]
Original file line number Diff line number Diff line change @@ -133,4 +133,17 @@ pub enum NetworkLayer {
133133 Layer3 ,
134134}
135135
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+
136149fn main ( ) { }
Original file line number Diff line number Diff line change @@ -97,5 +97,29 @@ LL | | }
9797 = note: `-D clippy::pub-enum-variant-names` implied by `-D warnings`
9898 = help: remove the prefixes and use full paths to the variants instead of glob imports
9999
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
101125
You can’t perform that action at this time.
0 commit comments