Skip to content
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

Add a rule to catch int(round(...) #11412

Closed
NeilGirdhar opened this issue May 13, 2024 · 2 comments · Fixed by #14697
Closed

Add a rule to catch int(round(...) #11412

NeilGirdhar opened this issue May 13, 2024 · 2 comments · Fixed by #14697
Labels
rule Implementing or modifying a lint rule

Comments

@NeilGirdhar
Copy link

NeilGirdhar commented May 13, 2024

int(round(x))and int(round(x, 0)) and int(round(x, None)) can all simply be written round(x). However, unnecessary casts to int are prevalent. Please consider adding a rule to catch these?

@zanieb zanieb added the rule Implementing or modifying a lint rule label May 13, 2024
@zanieb
Copy link
Member

zanieb commented May 13, 2024

Seems reasonable to me. unnecessary-round-cast or something?

@Skylion007
Copy link
Contributor

This sounds like a good refurb rule. @dosisod

MichaReiser added a commit that referenced this issue Dec 5, 2024
## Summary

Resolves #11412.

## Test Plan

`cargo nextest run` and `cargo insta test`.

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants