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 @@ -244,18 +244,17 @@ macro_rules! impl_Display {
244244
245245 // Format per four digits from the lookup table.
246246 // Four digits need a 16-bit $unsigned or wider.
247- #[ allow( overflowing_literals) ]
248- #[ allow( unused_comparisons) ]
249- while remain > 999 {
247+ while const { Self :: MAX as u128 > 999 } && remain > 999 . try_into( ) . unwrap( ) {
250248 // SAFETY: All of the decimals fit in buf due to MAX_DEC_N.
251249 unsafe { core:: hint:: assert_unchecked( offset >= 4 ) }
252250 // SAFETY: The offset counts down from its initial buf.len()
253251 // without underflow due to the previous assertion.
254252 unsafe { core:: hint:: assert_unchecked( offset <= buf. len( ) ) }
255253 offset -= 4 ;
256254
257- let quad = remain % 100_00 ;
258- remain /= 100_00 ;
255+ let scale: Self = 100_00 . try_into( ) . unwrap( ) ;
256+ let quad = remain % scale;
257+ remain /= scale;
259258 let pair1 = ( quad / 100 ) as usize ;
260259 let pair2 = ( quad % 100 ) as usize ;
261260 buf[ offset + 0 ] . write( DEC_DIGITS_LUT [ pair1 * 2 + 0 ] ) ;
You can’t perform that action at this time.
0 commit comments