Conversation
|
r? @giraffate (rustbot has picked a reviewer for you, use r? to override) |
|
☔ The latest upstream changes (presumably #10283) made this pull request unmergeable. Please resolve the merge conflicts. |
147961e to
e0a1fc6
Compare
|
r? clippy |
|
☔ The latest upstream changes (presumably #12306) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Hey @Jarcho woudl you mind rebasing this PR? Hey @GuillaumeGomez, if you have the time, could you give this PR a review? r? xFrednet |
f768816 to
b6623ac
Compare
|
☔ The latest upstream changes (presumably #12999) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Roses == Red |
`float_cmp` changes fixes #2834 fixes #6816 --- changelog: This: * Deprecated `float_cmp_const` in favor of a config option on [`float_cmp`]. [#11948](#11948) * [`float_cmp`]: Don't lint literal and self comparisons. [#11948](#11948) * [`float_cmp`] [#11948](#11948) * Add the [`float-cmp-ignore-named-constants`] configuration to ignore comparisons to named constants. * Add the [`float-cmp-ignore-change-detection`] configuration to ignore const-evaluatabled values. * Add the [`float-cmp-ignore-constant-comparisons`] configuration to ignore comparisons to the modification of an operand (e.g. `x == f(x)`).
|
💔 Test failed - checks-action_test |
|
☔ The latest upstream changes (presumably #13088) made this pull request unmergeable. Please resolve the merge conflicts. |
…constants to `float_cmp`
e1550af to
083300b
Compare
|
Latest commit changes named constants to be allowed individually rather than as a group. This feature was originally added to allow comparisons to a sentinel value rather than constants in general. |
xFrednet
left a comment
There was a problem hiding this comment.
One comment and then I'd say it's good to go :D
| /// x == VALUE | ||
| /// } | ||
| /// ``` | ||
| (float_cmp_allowed_constants: Vec<String> = Vec::new()), |
There was a problem hiding this comment.
I would suggest adding "*" as a magic value that says that all constants are allowed. THis should also be documented.
There was a problem hiding this comment.
This would be better done in a more uniform way across all the multi-value configs.
There was a problem hiding this comment.
While true, I'm not sure how many lints would benefit from an everything "*" configuration. #12571 comes to mind, where I also suggested this with a Zulip thread.
|
An alternative to the current configs would be to have a single heuristics config taking a list of names. e.g. float_cmp_heuristics = ["constant_cmp", "change_detection", "signum_cmp", "cmp_zero"]This would make it possible to preemptively disable future heuristics as well as an easier way to disable all of them. |
Having heuristics as strings in a list feels weird to me. They should be boolean flags IMO. That also makes it easier for format error reporting etc |
|
☔ The latest upstream changes (presumably #13168) made this pull request unmergeable. Please resolve the merge conflicts. |
|
I'm unassigning myself from this PR. @Jarcho if you want to continue this work, please request a new reviewer with |
|
☔ The latest upstream changes (possibly d28d234) made this pull request unmergeable. Please resolve the merge conflicts. |
fixes #2834
fixes #6816
changelog: This:
float_cmp_constin favor of a config option on [float_cmp].#11948
float_cmp] #11948float-cmp-ignore-named-constants] configuration to ignore comparisons to named constants.float-cmp-ignore-change-detection] configuration to ignore const-evaluatabled values.float-cmp-ignore-constant-comparisons] configuration to ignore comparisons to the modification of an operand (e.g.x == f(x)).