-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 manual_saturating_arithmetic lint #4498
Conversation
54bf6f4
to
4960f79
Compare
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.
Awesome! Completely new lint and I don't even have a single thing to complain about. 🎉
Thanks!
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.
Ha, found something 😄
Thanks! @bors r+ |
📌 Commit c6fb9c8 has been approved by |
Add manual_saturating_arithmetic lint changelog: add `manual_saturating_arithmetic` lint Fixes #1557. This lint detects manual saturating arithmetics like `x.checked_add(10u32).unwrap_or(u32::max_value())` and suggests replacing with `x.saturating_add(10u32)`.
I suggest using |
@Izutao There's |
☀️ Test successful - checks-travis, status-appveyor |
changelog: add
manual_saturating_arithmetic
lintFixes #1557. This lint detects manual saturating arithmetics like
x.checked_add(10u32).unwrap_or(u32::max_value())
and suggests replacing withx.saturating_add(10u32)
.