From e91540fc0792ab563fe2a35a52299024902b88cf Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 15 Jan 2024 10:27:59 +0100 Subject: [PATCH] uucore: fix clippy warning from if_not_else lint --- src/uucore/src/lib/features/format/num_format.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uucore/src/lib/features/format/num_format.rs b/src/uucore/src/lib/features/format/num_format.rs index 325da3ce6e3..ea5d6a75316 100644 --- a/src/uucore/src/lib/features/format/num_format.rs +++ b/src/uucore/src/lib/features/format/num_format.rs @@ -146,10 +146,10 @@ impl Formatter for UnsignedInt { // We also need to take into account that 0 should not be 00 // Since this is an unsigned int, we do not need to take the minus // sign into account. - if x != 0 { - format!("0{x:o}") - } else { + if x == 0 { format!("{x:o}") + } else { + format!("0{x:o}") } } UnsignedIntVariant::Hexadecimal(Case::Lowercase, Prefix::No) => {