|
21 | 21 | //! assert_eq!(summand1 + summand2, ExtendedBigDecimal::Infinity); |
22 | 22 | //! ``` |
23 | 23 | use std::cmp::Ordering; |
24 | | -use std::fmt::Display; |
25 | 24 | use std::ops::Add; |
26 | 25 | use std::ops::Neg; |
27 | 26 |
|
@@ -110,25 +109,6 @@ impl ExtendedBigDecimal { |
110 | 109 | } |
111 | 110 | } |
112 | 111 |
|
113 | | -impl Display for ExtendedBigDecimal { |
114 | | - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
115 | | - match self { |
116 | | - Self::BigDecimal(x) => { |
117 | | - let (n, p) = x.as_bigint_and_exponent(); |
118 | | - match p { |
119 | | - 0 => Self::BigDecimal(BigDecimal::new(n * 10, 1)).fmt(f), |
120 | | - _ => x.fmt(f), |
121 | | - } |
122 | | - } |
123 | | - Self::Infinity => f32::INFINITY.fmt(f), |
124 | | - Self::MinusInfinity => f32::NEG_INFINITY.fmt(f), |
125 | | - Self::MinusZero => (-0.0f32).fmt(f), |
126 | | - Self::Nan => "nan".fmt(f), |
127 | | - Self::MinusNan => "-nan".fmt(f), |
128 | | - } |
129 | | - } |
130 | | -} |
131 | | - |
132 | 112 | impl Zero for ExtendedBigDecimal { |
133 | 113 | fn zero() -> Self { |
134 | 114 | Self::BigDecimal(BigDecimal::zero()) |
@@ -281,16 +261,4 @@ mod tests { |
281 | 261 | _ => unreachable!(), |
282 | 262 | } |
283 | 263 | } |
284 | | - |
285 | | - #[test] |
286 | | - fn test_display() { |
287 | | - assert_eq!( |
288 | | - format!("{}", ExtendedBigDecimal::BigDecimal(BigDecimal::zero())), |
289 | | - "0.0" |
290 | | - ); |
291 | | - assert_eq!(format!("{}", ExtendedBigDecimal::Infinity), "inf"); |
292 | | - assert_eq!(format!("{}", ExtendedBigDecimal::MinusInfinity), "-inf"); |
293 | | - assert_eq!(format!("{}", ExtendedBigDecimal::Nan), "nan"); |
294 | | - assert_eq!(format!("{}", ExtendedBigDecimal::MinusZero), "-0"); |
295 | | - } |
296 | 264 | } |
0 commit comments