feat: detect == 0 on unsigned types as a manual_clamp lower bound - #16800
Conversation
|
r? @dswij rustbot has assigned @dswij. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Hello @dswij and @LesnyRumcajs, I hope that you don't mind we using this contribution to teach @medzernik some things about reviewing (they were very interested!). This is how most Clippy contributions are structured, some code (usually in between 50 - 200 lines), and then some tests are added. Things to take into account when reviewing:
Also, make sure to check the lintcheck results. And remember that you're not the only reviewing! We are fortunate in that, if Clippy fails, nobody dies! So there's no pressure to catch 100% of the bugs on the first try. I'll also mention you in another 6-12 pull requests. My suggestion is that you go 1 by 1 and let me know if you have any questions. |
|
r? @medzernik |
|
Hello @medzernik, I'm sorry for the misunderstanding, I thought you were talking about assigning me to your pull requests. In fact, I didn't even know a non-member had permission to override an assignment like that. For this one we'll keep it, but please don't do it again 😅 |
Oh. Oops. I did it on all 5 xD Sorry.. :D |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
e2c0873 to
900aad6
Compare
79ef17e to
b3915d6
Compare
b3915d6 to
21a39ad
Compare
|
@blyxyas It should be all green now! I thought there was just a minor import reshuffle conflict, but turned out |
|
@medzernik do you want to merge this yourself? @rustbot delegate=@medzernik |
|
✌️ @medzernik, you can now merge this pull request! If @blyxyas told you to merge after making some further change, then please make that change and post |
|
@rustbot merge |
Closes #16792
For unsigned types,
if x == 0can be expressed asif x < 1. The former was not caught bymanual_clamplint; this PR normalizes it so that cases as described in the linked issue are caught.changelog:
manual_clampdetect== 0on unsigned types as a clamp lower bound