Skip to content

Commit 636e4a7

Browse files
committed
uucore/format: remove Display impl
of ExtendedBigDecimal
1 parent eaa8332 commit 636e4a7

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/uucore/src/lib/features/format/extendedbigdecimal.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
//! assert_eq!(summand1 + summand2, ExtendedBigDecimal::Infinity);
2222
//! ```
2323
use std::cmp::Ordering;
24-
use std::fmt::Display;
2524
use std::ops::Add;
2625
use std::ops::Neg;
2726

@@ -110,25 +109,6 @@ impl ExtendedBigDecimal {
110109
}
111110
}
112111

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-
132112
impl Zero for ExtendedBigDecimal {
133113
fn zero() -> Self {
134114
Self::BigDecimal(BigDecimal::zero())
@@ -281,16 +261,4 @@ mod tests {
281261
_ => unreachable!(),
282262
}
283263
}
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-
}
296264
}

0 commit comments

Comments
 (0)