mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 01:17:16 +00:00
52 lines
1.7 KiB
Text
52 lines
1.7 KiB
Text
error: manual implementation of `abs` method
|
|
--> $DIR/floating_point_abs.rs:15:5
|
|
|
|
|
LL | if num >= 0.0 { num } else { -num }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
|
|
|
|
|
= note: `-D clippy::suboptimal-flops` implied by `-D warnings`
|
|
|
|
error: manual implementation of `abs` method
|
|
--> $DIR/floating_point_abs.rs:19:5
|
|
|
|
|
LL | if 0.0 < num { num } else { -num }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
|
|
|
|
error: manual implementation of `abs` method
|
|
--> $DIR/floating_point_abs.rs:23:5
|
|
|
|
|
LL | if a.a > 0.0 { a.a } else { -a.a }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.a.abs()`
|
|
|
|
error: manual implementation of `abs` method
|
|
--> $DIR/floating_point_abs.rs:27:5
|
|
|
|
|
LL | if 0.0 >= num { -num } else { num }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
|
|
|
|
error: manual implementation of `abs` method
|
|
--> $DIR/floating_point_abs.rs:31: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
|
|
--> $DIR/floating_point_abs.rs:35:5
|
|
|
|
|
LL | if num < 0.0 { num } else { -num }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-num.abs()`
|
|
|
|
error: manual implementation of negation of `abs` method
|
|
--> $DIR/floating_point_abs.rs:39:5
|
|
|
|
|
LL | if 0.0 >= num { num } else { -num }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-num.abs()`
|
|
|
|
error: manual implementation of negation of `abs` method
|
|
--> $DIR/floating_point_abs.rs:44: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
|
|
|