-
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
Detect usage of custom floating-point abs implementation #5224
Labels
A-lint
Area: New lints
good-first-issue
These issues are a good way to get started with Clippy
L-complexity
Lint: Belongs in the complexity lint group
Comments
This should also lint the opposite case: if a < 0.0 { // or a.is_sign_negative()
a
} else {
-a
} and suggest |
flip1995
added
L-complexity
Lint: Belongs in the complexity lint group
good-first-issue
These issues are a good way to get started with Clippy
A-lint
Area: New lints
labels
Feb 25, 2020
I can work on this. This seems like a good point to begin contributing. |
Thanks! If you have questions, just ask here or open a WIP PR. A good read for starting writing lints is this documentation: https://github.com/rust-lang/rust-clippy/blob/master/doc/adding_lints.md |
bors
added a commit
that referenced
this issue
Mar 4, 2020
Detect usage of custom floating-point abs implementation Implements #5224
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-lint
Area: New lints
good-first-issue
These issues are a good way to get started with Clippy
L-complexity
Lint: Belongs in the complexity lint group
Detect usage of
and suggest usage of
abs
insteadUsing
abs
is more efficient, handles more cases and is more succinct than using the if/else block so this lint could go under thesuboptimal_flops
lint. If this seems like an obvious thing and isn't worth the check then I'd be happy to close it.The text was updated successfully, but these errors were encountered: