Skip to content

uucore: warning for clippy::if_not_else in features/format/num_format.rs #5837

@lcheylus

Description

@lcheylus

During some lint tests on OpenBSD (Rust 1.72.1) with rust-clippy, I found a warning/error for clippy::if_not_else in uucore/src/lib/features/format/num_format.rs (line 149, function Formatter::fmt).

// The prefix that rust uses is `0o`, but GNU uses `0`.
// 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 {
   format!("{x:o}")
}

I don't understand why this warning is not detected by CI job for Lint (clippy run with -D warning flag): clippy::if_not_else is included in warnings by default.

This warning could be removed with #[allow(clippy::if_not_else)] or maybe by modifying the if not/else logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions