-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(manual_saturating_arithmetic): lint x.checked_sub(y).unwrap_or_default()
#15845
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
base: master
Are you sure you want to change the base?
Conversation
r? @Alexendoo rustbot has assigned @Alexendoo. Use |
ff8d1fc
to
583af98
Compare
use self::MinMax::{Max, Min}; | ||
use CheckedArith::{Add, Mul, Sub}; |
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 say move these upwards rather than duplicating
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.
Decided to add a block just to keep the scoping a bit cleaner.. But maybe it'd be better not to bother
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.
Yeah I wouldn't say the block is needed
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.
Sure, removed it
The commit/PR title & description should be updated to say |
x.saturating_sub(y).unwrap_or_default()
x.checked_sub(y).unwrap_or_default()
583af98
to
04502af
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
04502af
to
95834c9
Compare
Resolves #15655
changelog: [
manual_saturating_arithmetic
]: lintx.checked_sub(y).unwrap_or_default()