diff --git a/src/uucore/src/lib/features/format/num_format.rs b/src/uucore/src/lib/features/format/num_format.rs index 4c4a541c4..9dd371817 100644 --- a/src/uucore/src/lib/features/format/num_format.rs +++ b/src/uucore/src/lib/features/format/num_format.rs @@ -168,6 +168,24 @@ impl Formatter for UnsignedInt { } fn try_from_spec(s: Spec) -> Result { + // A signed int spec might be mapped to an unsigned int spec if no sign is specified + let s = if let Spec::SignedInt { + width, + precision, + positive_sign: PositiveSign::None, + alignment, + } = s + { + Spec::UnsignedInt { + variant: UnsignedIntVariant::Decimal, + width, + precision, + alignment, + } + } else { + s + }; + let Spec::UnsignedInt { variant, width,