mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
85 lines
2.2 KiB
Text
85 lines
2.2 KiB
Text
error: This looks like you've implemented your own absolute value function
|
|
--> $DIR/floating_point_abs.rs:9:5
|
|
|
|
|
LL | / if num >= 0.0 {
|
|
LL | | num
|
|
LL | | } else {
|
|
LL | | -num
|
|
LL | | }
|
|
| |_____^ help: try: `num.abs()`
|
|
|
|
|
= note: `-D clippy::suboptimal-flops` implied by `-D warnings`
|
|
|
|
error: This looks like you've implemented your own absolute value function
|
|
--> $DIR/floating_point_abs.rs:17:5
|
|
|
|
|
LL | / if 0.0 < num {
|
|
LL | | num
|
|
LL | | } else {
|
|
LL | | -num
|
|
LL | | }
|
|
| |_____^ help: try: `num.abs()`
|
|
|
|
error: This looks like you've implemented your own absolute value function
|
|
--> $DIR/floating_point_abs.rs:25:5
|
|
|
|
|
LL | / if a.a > 0.0 {
|
|
LL | | a.a
|
|
LL | | } else {
|
|
LL | | -a.a
|
|
LL | | }
|
|
| |_____^ help: try: `a.a.abs()`
|
|
|
|
error: This looks like you've implemented your own absolute value function
|
|
--> $DIR/floating_point_abs.rs:33:5
|
|
|
|
|
LL | / if 0.0 >= num {
|
|
LL | | -num
|
|
LL | | } else {
|
|
LL | | num
|
|
LL | | }
|
|
| |_____^ help: try: `num.abs()`
|
|
|
|
error: This looks like you've implemented your own absolute value function
|
|
--> $DIR/floating_point_abs.rs:41:5
|
|
|
|
|
LL | / if a.a < 0.0 {
|
|
LL | | -a.a
|
|
LL | | } else {
|
|
LL | | a.a
|
|
LL | | }
|
|
| |_____^ help: try: `a.a.abs()`
|
|
|
|
error: This looks like you've implemented your own negative absolute value function
|
|
--> $DIR/floating_point_abs.rs:49:5
|
|
|
|
|
LL | / if num < 0.0 {
|
|
LL | | num
|
|
LL | | } else {
|
|
LL | | -num
|
|
LL | | }
|
|
| |_____^ help: try: `-num.abs()`
|
|
|
|
error: This looks like you've implemented your own negative absolute value function
|
|
--> $DIR/floating_point_abs.rs:57:5
|
|
|
|
|
LL | / if 0.0 >= num {
|
|
LL | | num
|
|
LL | | } else {
|
|
LL | | -num
|
|
LL | | }
|
|
| |_____^ help: try: `-num.abs()`
|
|
|
|
error: This looks like you've implemented your own negative absolute value function
|
|
--> $DIR/floating_point_abs.rs:65:12
|
|
|
|
|
LL | A { a: if a.a >= 0.0 {
|
|
| ____________^
|
|
LL | | -a.a
|
|
LL | | } else {
|
|
LL | | a.a
|
|
LL | | }, b: a.b }
|
|
| |_________^ help: try: `-a.a.abs()`
|
|
|
|
error: aborting due to 8 previous errors
|
|
|