Skip to content

od: lint error legacy_numeric_constants with Rust 1.79.0 #6475

@lcheylus

Description

@lcheylus

When checking lint errors with Rust v1.79.0 (cargo clippy), I have an "usage of a legacy numeric method" error with cargo clippy in src/uu/od/src/partialreader.rs (line 154).

$ cargo clippy --all-targets -puu_od -- -W clippy::manual_string_new -D warnings
(...)
    Checking uucore v0.0.26 (/home/fox/dev/Perso/rust-coreutils.git/src/uucore)
    Checking uu_od v0.0.26 (/home/fox/dev/Perso/rust-coreutils.git/src/uu/od)
error: usage of a legacy numeric method
   --> src/uu/od/src/partialreader.rs:154:20
    |
154 |             usize::max_value() as u64,
    |                    ^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants
    = note: `-D clippy::legacy-numeric-constants` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::legacy_numeric_constants)]`
help: use the associated constant instead
    |
154 |             usize::MAX as u64,
    |                    ~~~

error: could not compile `uu_od` (lib test) due to 1 previous error

This check for "legacy_numeric_constants" (see https://rust-lang.github.io/rust-clippy/master/index.html#/legacy_numeric_constants) was added in Rust version 1.79.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions