File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,9 @@ fn is_camel_case(name: &str) -> bool {
93
93
// contains a capitalisable character followed by, or preceded by, an underscore
94
94
char_has_case ( fst) && snd == '_' || char_has_case ( snd) && fst == '_'
95
95
} )
96
+ && !name. chars ( ) . collect :: < Vec < _ > > ( ) . array_windows ( ) . any ( |& [ fst, snd, thr] | {
97
+ fst. is_uppercase ( ) && snd. is_uppercase ( ) && thr. is_uppercase ( )
98
+ } )
96
99
}
97
100
98
101
fn to_camel_case ( s : & str ) -> String {
Original file line number Diff line number Diff line change @@ -18,4 +18,9 @@ fn camel_case() {
18
18
19
19
assert ! ( !is_camel_case( "ONE_TWO_THREE" ) ) ;
20
20
assert_eq ! ( to_camel_case( "ONE_TWO_THREE" ) , "OneTwoThree" ) ;
21
+
22
+ assert ! ( !is_camel_case( "ONE" ) ) ;
23
+ assert_eq ! ( to_camel_case( "ONE" ) , "One" ) ;
24
+
25
+ assert ! ( is_camel_case( "AStr" ) ) ;
21
26
}
You can’t perform that action at this time.
0 commit comments