@@ -258,16 +258,6 @@ macro_rules! impl_Unsigned {
258258 . try_into( )
259259 . expect( "branch is not hit for types that cannot fit 999 (u8)" )
260260 {
261- // SAFETY: All of the decimals fit in buf due to MAX_DEC_N
262- // and the while condition ensures at least 4 more decimals.
263- if offset < 4 {
264- unsafe { hint:: unreachable_unchecked( ) } ;
265- }
266- // SAFETY: The offset counts down from its initial buf.len()
267- // without underflow due to the previous precondition.
268- if offset > buf. len( ) {
269- unsafe { hint:: unreachable_unchecked( ) } ;
270- }
271261 offset -= 4 ;
272262
273263 // pull two pairs
@@ -286,16 +276,6 @@ macro_rules! impl_Unsigned {
286276
287277 // Format per two digits from the lookup table.
288278 if remain > 9 {
289- // SAFETY: All of the decimals fit in buf due to MAX_DEC_N
290- // and the if condition ensures at least 2 more decimals.
291- if offset < 2 {
292- unsafe { hint:: unreachable_unchecked( ) } ;
293- }
294- // SAFETY: The offset counts down from its initial buf.len()
295- // without underflow due to the previous precondition.
296- if offset > buf. len( ) {
297- unsafe { hint:: unreachable_unchecked( ) } ;
298- }
299279 offset -= 2 ;
300280
301281 let pair = ( remain % 100 ) as usize ;
@@ -306,16 +286,6 @@ macro_rules! impl_Unsigned {
306286
307287 // Format the last remaining digit, if any.
308288 if remain != 0 || self == 0 {
309- // SAFETY: All of the decimals fit in buf due to MAX_DEC_N
310- // and the if condition ensures (at least) 1 more decimals.
311- if offset < 1 {
312- unsafe { hint:: unreachable_unchecked( ) } ;
313- }
314- // SAFETY: The offset counts down from its initial buf.len()
315- // without underflow due to the previous precondition.
316- if offset > buf. len( ) {
317- unsafe { hint:: unreachable_unchecked( ) } ;
318- }
319289 offset -= 1 ;
320290
321291 // Either the compiler sees that remain < 10, or it prevents
@@ -368,16 +338,6 @@ impl Unsigned for u128 {
368338
369339 // Format per four digits from the lookup table.
370340 while remain > 999 {
371- // SAFETY: All of the decimals fit in buf due to u128::MAX_STR_LEN
372- // and the while condition ensures at least 4 more decimals.
373- if offset < 4 {
374- unsafe { hint:: unreachable_unchecked ( ) } ;
375- }
376- // SAFETY: The offset counts down from its initial buf.len()
377- // without underflow due to the previous precondition.
378- if offset > buf. len ( ) {
379- unsafe { hint:: unreachable_unchecked ( ) } ;
380- }
381341 offset -= 4 ;
382342
383343 // pull two pairs
@@ -393,16 +353,6 @@ impl Unsigned for u128 {
393353
394354 // Format per two digits from the lookup table.
395355 if remain > 9 {
396- // SAFETY: All of the decimals fit in buf due to u128::MAX_STR_LEN
397- // and the if condition ensures at least 2 more decimals.
398- if offset < 2 {
399- unsafe { hint:: unreachable_unchecked ( ) } ;
400- }
401- // SAFETY: The offset counts down from its initial buf.len()
402- // without underflow due to the previous precondition.
403- if offset > buf. len ( ) {
404- unsafe { hint:: unreachable_unchecked ( ) } ;
405- }
406356 offset -= 2 ;
407357
408358 let pair = ( remain % 100 ) as usize ;
@@ -413,16 +363,6 @@ impl Unsigned for u128 {
413363
414364 // Format the last remaining digit, if any.
415365 if remain != 0 {
416- // SAFETY: All of the decimals fit in buf due to u128::MAX_STR_LEN
417- // and the if condition ensures (at least) 1 more decimals.
418- if offset < 1 {
419- unsafe { hint:: unreachable_unchecked ( ) } ;
420- }
421- // SAFETY: The offset counts down from its initial buf.len()
422- // without underflow due to the previous precondition.
423- if offset > buf. len ( ) {
424- unsafe { hint:: unreachable_unchecked ( ) } ;
425- }
426366 offset -= 1 ;
427367
428368 // Either the compiler sees that remain < 10, or it prevents
0 commit comments