-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
new implicit_saturating_add
lint
#9549
Conversation
r? @giraffate (rust-highfive has picked a reviewer for you, use r? to override) |
r?@llogiq |
manual_saturating_add
lintimplicit_saturating_add
lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This already looks pretty good. We best make sure to only lint when nothing is in the else branch of the if expression, otherwise this should be mergeable.
tests/ui/manual_saturating_add.rs
Outdated
if u8::MAX > a { | ||
b += 1; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see tests against additional.statements in either then or else branch (noting that this led to false positives in the implicit-saturating-sub lint).
I think you'll need to rebase on current master before CI will run. |
Thank you! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This fixes #9393
If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.
.stderr
file)cargo test
passes locallycargo dev update_lints
cargo dev fmt
changelog: add [
manual_saturating_add
] lint