Skip to content

Clippy thinks casting u8/u16 to usize is infallible #153213

Description

let u: usize = u16::MAX.try_into().unwrap(); Clippy suggests using .into().
warning: use of a fallible conversion when an infallible one could be used
Although we use 64-bit targets nowadays, but I think the conversion is still fallible if we need to compile for targets using 8-bit or even smaller pointer size, e.g, microcontroller or single chip?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions