-
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
Fix span issue on implicit_saturating_sub
#13533
Conversation
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.
Looks great, thank you!
@bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
1 similar comment
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request. |
} else if a >= b { | ||
b.saturating_sub(a) | ||
} else { | ||
b - a | ||
} |
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'm a bit late, but reading through #13524, shouldn't the fixed code be just } else { b.saturating_sub(a) }
(old suggestion was almost correct but it was missing braces)?
The new suggestion adds more code instead of simplifying it like before (changes a 0
to saturating_sub
instead of the whole if
)? 👀
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 did some more debugging, and yep, it was a mistake, #13542 is now open reverting this and implementing a more robust solution ❤️
[`implicit_saturating_sub`] Fix suggestion with a less volatile approach Related to #13533, such and obvious mistake got pass my watch, quite embarassing :/ Revert #13533 and implement a more robust solution. Revert "Fix span issue on `implicit_saturating_sub` This reverts commit 140a127. changelog: [`lint_name`]: Fix suggestion for `if {} else if {} else {}` cases r? `@y21`
Fixes #13524
changelog: [
implicit_saturating_sub
]: Fix span issue on else blocks