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 {
9393 // contains a capitalisable character followed by, or preceded by, an underscore
9494 char_has_case ( fst) && snd == '_' || char_has_case ( snd) && fst == '_'
9595 } )
96+ && !name. chars ( ) . collect :: < Vec < _ > > ( ) . array_windows ( ) . any ( |& [ fst, snd, thr] | {
97+ fst. is_uppercase ( ) && snd. is_uppercase ( ) && thr. is_uppercase ( )
98+ } )
9699}
97100
98101fn to_camel_case ( s : & str ) -> String {
Original file line number Diff line number Diff line change @@ -18,4 +18,9 @@ fn camel_case() {
1818
1919 assert ! ( !is_camel_case( "ONE_TWO_THREE" ) ) ;
2020 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" ) ) ;
2126}
You can’t perform that action at this time.
0 commit comments