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 {
295295 // not used: remain = 0;
296296 }
297297
298- // SAFETY: Offset has been used as a write index.
299- unsafe { core:: hint:: assert_unchecked( offset < buf. len( ) ) }
300- let written = & buf[ offset..] ;
301298 // SAFETY: All buf content since offset is set with bytes form
302299 // the lookup table, which consists of valid ASCII exclusively.
303300 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+ ) )
306306 } )
307307 }
308308 } ) *
You can’t perform that action at this time.
0 commit comments