Skip to content

0i8.abs() as u8 is not lossy #4605

Closed
@jhpratt

Description

@jhpratt

A special case for cast_sign_loss, if the absolute value is taken, the value is guaranteed to be non-negative. As such, a cast from iX to uY where Y >= X is unquestionably safe.

I'm using clippy 0.0.212 (cd3df6b 2019-08-20), though I suspect this hasn't changed in the meantime.

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