Skip to content

Suggest integer_sign_cast usage #14172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
leonardo-m opened this issue Feb 7, 2025 · 2 comments
Closed

Suggest integer_sign_cast usage #14172

leonardo-m opened this issue Feb 7, 2025 · 2 comments
Labels
A-lint Area: New lints

Comments

@leonardo-m
Copy link

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>
@leonardo-m leonardo-m added the A-lint Area: New lints label Feb 7, 2025
@Rua
Copy link
Contributor

Rua commented Feb 14, 2025

I think it's the same as #14150?

@leonardo-m
Copy link
Author

Yes, so I close this down, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

No branches or pull requests

2 participants