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
[manual_range_patterns
]: lint negative values
#11096
Conversation
r? @giraffate (rustbot has picked a reviewer for you, use r? to override) |
Okay, I think this requires some pretty involved changes to handle "large" numbers correctly. For example: matches!(
1u128,
340282366920938463463374607431768211455
| 340282366920938463463374607431768211454
| 340282366920938463463374607431768211453
); This currently emits the warning "help: try: |
The type of the integer is known in |
yep but what I mean is that, unless I'm overthinking this way too much, the logic will get very complicated very quickly here now that we need these casts and checks basically for every use of |
That's a good point. |
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.
(or I guess we could also just ignore numbers >i128::MAX for now 🤔 )
IMO it would be better to ignore these numbers or just note it in Known problems
section.
@bors r+ Thanks! |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #11091.
Now also lints negative values in patterns (
-1 | -2 | -3
)changelog: [
manual_range_patterns
]: lint negative values