diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index b08db45635b..fd0f11aecbd 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -235,22 +235,21 @@ fn write_value_float( width: usize, precision: Option, ) -> std::io::Result<()> { - let value_as_str = if let Some(precision) = precision { + let value_as_str = match precision { // format with precision: decimal floats and integers - match value { + Some(precision) => match value { ExtendedBigDecimal::Infinity | ExtendedBigDecimal::MinusInfinity => { format!("{value:>width$.precision$}") } _ => format!("{value:>0width$.precision$}"), - } - } else { + }, // format without precision: hexadecimal floats - match value { + None => match value { ExtendedBigDecimal::BigDecimal(bd) => { - format_bigdecimal(bd).unwrap_or("{value}".to_owned()) + format_bigdecimal(bd).unwrap_or_else(|| "{value}".to_owned()) } _ => format!("{value:>0width$}"), - } + }, }; write!(writer, "{value_as_str}") }