-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[redundant_guards
]: don't lint on float literals
#11305
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.
Just one thing, other than that this looks fine
_ => todo!(), | ||
} | ||
match FloatWrapper(0.1) { | ||
x if x == FloatWrapper(0.0) => todo!(), |
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.
We'd ideally suggest FloatWrapper(f) if f == 0.0
here, but that can be done in the future.
Will approve once CI finishes |
@bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
#13698) Two changes to `redundant_guards`: - Lint float literals. We used to do that before but that was changed in #11305 because at the time there was a future compat warning and it was planned to make pattern matching floats a hard error. In rust-lang/rust#116284 it was decided to actually remove the lint and only make matching `NAN` specifically a hard error. The `NAN` part isn't relevant/important here because this PR only changes what literals are warned and `f64::NAN` isn't a literal, but I've added a test anyway to make sure we continue to not lint there. - Don't lint CStr literals because that can't be a pattern right now (fixes #13681) changelog: none
Fixes #11304
changelog: [
redundant_guards
]: don't lint on float literalsr? @Centri3 i figured you are probably a good reviewer for this since you implemented the lint ^^