fix incorrect suggestion in `suboptimal_flops` by EricWu2003 · Pull Request #101...
source link: https://github.com/rust-lang/rust-clippy/pull/10113
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Contributor
EricWu2003 commented Dec 23, 2022
fixes #10003
There was an error when trying to negate an expression like x - 1.0
. We used to format it as -x - 1.0
whereas a proper negation would be -(x - 1.0)
.
Therefore, we add parentheses around the expression when it is ExprKind::Binary
.
We also add parentheses around multiply and divide expressions, even though this is not strictly necessary.
changelog: [suboptimal_flops
]: fix incorrect suggestion caused by an incorrect negation of floating point expressions.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK