File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -871,13 +871,17 @@ impl NonSnakeCase {
871871 fn to_snake_case ( str : & str ) -> String {
872872 let mut words = vec ! [ ] ;
873873 for s in str. split ( '_' ) {
874+ let mut last_upper = false ;
874875 let mut buf = String :: new ( ) ;
875876 if s. is_empty ( ) { continue ; }
876877 for ch in s. chars ( ) {
877- if !buf. is_empty ( ) && buf. as_slice ( ) != "'" && ch. is_uppercase ( ) {
878+ if !buf. is_empty ( ) && buf. as_slice ( ) != "'"
879+ && ch. is_uppercase ( )
880+ && !last_upper {
878881 words. push ( buf) ;
879882 buf = String :: new ( ) ;
880883 }
884+ last_upper = ch. is_uppercase ( ) ;
881885 buf. push_char ( ch. to_lowercase ( ) ) ;
882886 }
883887 words. push ( buf) ;
Original file line number Diff line number Diff line change @@ -23,11 +23,14 @@ impl Foo {
2323
2424 pub fn xyZ ( & mut self ) { }
2525 //~^ ERROR method `xyZ` should have a snake case name such as `xy_z`
26+
27+ fn render_HTML ( ) { }
28+ //~^ ERROR method `render_HTML` should have a snake case name such as `render_html`
2629}
2730
2831trait X {
2932 fn ABC ( ) ;
30- //~^ ERROR trait method `ABC` should have a snake case name such as `a_b_c `
33+ //~^ ERROR trait method `ABC` should have a snake case name such as `abc `
3134
3235 fn a_b_C ( & self ) { }
3336 //~^ ERROR trait method `a_b_C` should have a snake case name such as `a_b_c`
You can’t perform that action at this time.
0 commit comments