Skip to content

Suggest integer_sign_cast usage #14172

Closed
Closed
@leonardo-m

Description

@leonardo-m

What it does

I suggest to add a lint, when the time is ripe, that suggests to replace some "as" integer casts with the nicer signed/unsigned cast functions:

rust-lang/rust#125882

Advantage

It's a little safer than as casts, and it isn't easy to remember that such standard functions exist.

Drawbacks

No response

Example

<code>

Could be written as:

<code>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions