@@ -347,16 +347,16 @@ impl FormatSpec {
347
347
let precision = self . precision . unwrap_or ( 6 ) ;
348
348
let magnitude = num. abs ( ) ;
349
349
let raw_magnitude_string_result: Result < String , & ' static str > = match self . format_type {
350
- Some ( FormatType :: FixedPointUpper ) => match magnitude {
351
- magnitude if magnitude . is_nan ( ) => Ok ( "NAN" . to_owned ( ) ) ,
352
- magnitude if magnitude . is_infinite ( ) => Ok ( "INF" . to_owned ( ) ) ,
353
- _ => Ok ( format ! ( "{:.*}" , precision , magnitude ) ) ,
354
- } ,
355
- Some ( FormatType :: FixedPointLower ) => match magnitude {
356
- magnitude if magnitude . is_nan ( ) => Ok ( "nan" . to_owned ( ) ) ,
357
- magnitude if magnitude . is_infinite ( ) => Ok ( "inf" . to_owned ( ) ) ,
358
- _ => Ok ( format ! ( "{:.*}" , precision , magnitude ) ) ,
359
- } ,
350
+ Some ( FormatType :: FixedPointUpper ) => Ok ( float_ops :: format_fixed (
351
+ precision ,
352
+ magnitude,
353
+ float_ops :: Case :: Upper ,
354
+ ) ) ,
355
+ Some ( FormatType :: FixedPointLower ) => Ok ( float_ops :: format_fixed (
356
+ precision ,
357
+ magnitude,
358
+ float_ops :: Case :: Lower ,
359
+ ) ) ,
360
360
Some ( FormatType :: Decimal ) => Err ( "Unknown format code 'd' for object of type 'float'" ) ,
361
361
Some ( FormatType :: Binary ) => Err ( "Unknown format code 'b' for object of type 'float'" ) ,
362
362
Some ( FormatType :: Octal ) => Err ( "Unknown format code 'o' for object of type 'float'" ) ,
0 commit comments