File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -232,15 +232,15 @@ pub trait ToSanitizedCase {
232
232
impl ToSanitizedCase for str {
233
233
fn to_sanitized_pascal_case ( & self ) -> Cow < str > {
234
234
let s = Case :: Pascal . sanitize ( self ) ;
235
- if s. as_bytes ( ) . get ( 0 ) . unwrap_or ( & 0 ) . is_ascii_digit ( ) {
235
+ if s. as_bytes ( ) . first ( ) . unwrap_or ( & 0 ) . is_ascii_digit ( ) {
236
236
Cow :: from ( format ! ( "_{}" , s) )
237
237
} else {
238
238
s
239
239
}
240
240
}
241
241
fn to_sanitized_constant_case ( & self ) -> Cow < str > {
242
242
let s = Case :: Constant . sanitize ( self ) ;
243
- if s. as_bytes ( ) . get ( 0 ) . unwrap_or ( & 0 ) . is_ascii_digit ( ) {
243
+ if s. as_bytes ( ) . first ( ) . unwrap_or ( & 0 ) . is_ascii_digit ( ) {
244
244
Cow :: from ( format ! ( "_{}" , s) )
245
245
} else {
246
246
s
@@ -250,7 +250,7 @@ impl ToSanitizedCase for str {
250
250
const INTERNALS : [ & str ; 4 ] = [ "set_bit" , "clear_bit" , "bit" , "bits" ] ;
251
251
252
252
let s = Case :: Snake . sanitize ( self ) ;
253
- if s. as_bytes ( ) . get ( 0 ) . unwrap_or ( & 0 ) . is_ascii_digit ( ) {
253
+ if s. as_bytes ( ) . first ( ) . unwrap_or ( & 0 ) . is_ascii_digit ( ) {
254
254
format ! ( "_{}" , s) . into ( )
255
255
} else if INTERNALS . contains ( & s. as_ref ( ) ) {
256
256
s + "_"
You can’t perform that action at this time.
0 commit comments