mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
53 lines
1.8 KiB
Text
53 lines
1.8 KiB
Text
error: manual implementation of `abs` method
|
|
--> tests/ui/floating_point_abs.rs:14:5
|
|
|
|
|
LL | if num >= 0.0 { num } else { -num }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
|
|
|
|
|
= note: `-D clippy::suboptimal-flops` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]`
|
|
|
|
error: manual implementation of `abs` method
|
|
--> tests/ui/floating_point_abs.rs:18:5
|
|
|
|
|
LL | if 0.0 < num { num } else { -num }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
|
|
|
|
error: manual implementation of `abs` method
|
|
--> tests/ui/floating_point_abs.rs:22:5
|
|
|
|
|
LL | if a.a > 0.0 { a.a } else { -a.a }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.a.abs()`
|
|
|
|
error: manual implementation of `abs` method
|
|
--> tests/ui/floating_point_abs.rs:26:5
|
|
|
|
|
LL | if 0.0 >= num { -num } else { num }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
|
|
|
|
error: manual implementation of `abs` method
|
|
--> tests/ui/floating_point_abs.rs:30:5
|
|
|
|
|
LL | if a.a < 0.0 { -a.a } else { a.a }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.a.abs()`
|
|
|
|
error: manual implementation of negation of `abs` method
|
|
--> tests/ui/floating_point_abs.rs:34:5
|
|
|
|
|
LL | if num < 0.0 { num } else { -num }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-num.abs()`
|
|
|
|
error: manual implementation of negation of `abs` method
|
|
--> tests/ui/floating_point_abs.rs:38:5
|
|
|
|
|
LL | if 0.0 >= num { num } else { -num }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-num.abs()`
|
|
|
|
error: manual implementation of negation of `abs` method
|
|
--> tests/ui/floating_point_abs.rs:43:12
|
|
|
|
|
LL | a: if a.a >= 0.0 { -a.a } else { a.a },
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-a.a.abs()`
|
|
|
|
error: aborting due to 8 previous errors
|
|
|