File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -111,9 +111,6 @@ fn snake_to_upper_case(s: &str) -> String {
111
111
if c == '_' {
112
112
result_chars. push ( '_' ) ;
113
113
} else {
114
- assert ! ( c. is_alphanumeric( ) ,
115
- format!( "non-alphanumeric character '{}', i.e. {} in identifier '{}'" ,
116
- c, c as usize , s) ) ;
117
114
result_chars. push ( c. to_ascii_uppercase ( ) ) ;
118
115
}
119
116
}
@@ -124,9 +121,6 @@ fn camel_to_snake_case(s: &str) -> String {
124
121
let mut result_chars: Vec < char > = Vec :: new ( ) ;
125
122
let mut first_char = true ;
126
123
for c in s. chars ( ) {
127
- assert ! ( c. is_alphanumeric( ) ,
128
- format!( "non-alphanumeric character '{}', i.e. {} in identifier '{}'" ,
129
- c, c as usize , s) ) ;
130
124
if c. is_uppercase ( ) && !first_char {
131
125
result_chars. push ( '_' ) ;
132
126
}
@@ -175,6 +169,8 @@ fn test_camel_to_snake_case() {
175
169
assert_eq ! ( camel_to_snake_case( "helloWorld" ) , "hello_world" . to_string( ) ) ;
176
170
assert_eq ! ( camel_to_snake_case( "HelloWorld" ) , "hello_world" . to_string( ) ) ;
177
171
assert_eq ! ( camel_to_snake_case( "uint32Id" ) , "uint32_id" . to_string( ) ) ;
172
+
173
+ assert_eq ! ( camel_to_snake_case( "fooBar_" ) , "foo_bar_" . to_string( ) ) ;
178
174
}
179
175
180
176
#[ derive( PartialEq , Clone ) ]
You can’t perform that action at this time.
0 commit comments