File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -436,8 +436,12 @@ impl FormatSpec {
436
436
let sep = char:: from ( fg) ;
437
437
let inter = self . get_separator_interval ( ) . try_into ( ) . unwrap ( ) ;
438
438
let magnitude_len = magnitude_str. len ( ) ;
439
- let width = self . width . unwrap_or ( magnitude_len) as i32 - prefix. len ( ) as i32 ;
440
- let disp_digit_cnt = cmp:: max ( width, magnitude_len as i32 ) ;
439
+ let disp_digit_cnt = if let Some ( '0' ) = self . fill . and_then ( |p| p. to_char ( ) ) {
440
+ let width = self . width . unwrap_or ( magnitude_len) as i32 - prefix. len ( ) as i32 ;
441
+ cmp:: max ( width, magnitude_len as i32 )
442
+ } else {
443
+ magnitude_len as i32
444
+ } ;
441
445
Self :: add_magnitude_separators_for_char ( magnitude_str, inter, sep, disp_digit_cnt)
442
446
}
443
447
None => magnitude_str,
You can’t perform that action at this time.
0 commit comments