File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -295,14 +295,14 @@ macro_rules! impl_Display {
295
295
// not used: remain = 0;
296
296
}
297
297
298
- // SAFETY: Offset has been used as a write index.
299
- unsafe { core:: hint:: assert_unchecked( offset < buf. len( ) ) }
300
- let written = & buf[ offset..] ;
301
298
// SAFETY: All buf content since offset is set with bytes form
302
299
// the lookup table, which consists of valid ASCII exclusively.
303
300
f. pad_integral( is_nonnegative, "" , unsafe {
304
- let as_init = MaybeUninit :: slice_assume_init_ref( written) ;
305
- str :: from_utf8_unchecked( as_init)
301
+ let written = buf. get_unchecked( offset..) ;
302
+ str :: from_utf8_unchecked( slice:: from_raw_parts(
303
+ MaybeUninit :: slice_as_ptr( written) ,
304
+ written. len( ) ,
305
+ ) )
306
306
} )
307
307
}
308
308
} ) *
You can’t perform that action at this time.
0 commit comments