File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -1184,11 +1184,10 @@ mod tests {
1184
1184
let ascii_str = arr. as_ref ( ) . into ( ) ;
1185
1185
let mut mut_arr = arr; // Note: We need a second copy to prevent overlapping mutable borrows.
1186
1186
let mut_ascii_str = mut_arr. as_mut ( ) . into ( ) ;
1187
- let mut_arr_mut_ref: & mut [ AsciiChar ] = & mut [ AsciiChar :: A ] ;
1188
- let mut string = "A" . to_string ( ) ;
1189
- let mut string2 = "A" . to_string ( ) ;
1190
- let string_mut = string. as_mut_str ( ) ;
1191
- let string_mut_bytes = unsafe { string2. as_bytes_mut ( ) } ; // SAFETY: We don't modify it
1187
+ let mut_arr_mut_ref: & mut [ AsciiChar ] = & mut [ AsciiChar :: A ] ;
1188
+ let mut string_bytes = [ b'A' ] ;
1189
+ let string_mut = unsafe { std:: str:: from_utf8_unchecked_mut ( & mut string_bytes) } ; // SAFETY: 'A' is a valid string.
1190
+ let string_mut_bytes: & mut [ u8 ] = & mut [ b'A' ] ;
1192
1191
1193
1192
// Note: This is a trick because `rustfmt` doesn't support
1194
1193
// attributes on blocks yet.
You can’t perform that action at this time.
0 commit comments