about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThiago Arrais <thiago.arrais@gmail.com>2020-06-17 13:43:11 -0300
committerThiago Arrais <thiago.arrais@gmail.com>2020-07-06 13:45:43 -0300
commit6dc066fdb9103122cd918b1b38e26fa6edbc7e2e (patch)
treeb5f6bffd223c2d0ca51209568debbbb688f7002e
parentdb7bc6b3bd0e58c8fbf7507713a4214299f39c36 (diff)
downloadrust-6dc066fdb9103122cd918b1b38e26fa6edbc7e2e.tar.gz
rust-6dc066fdb9103122cd918b1b38e26fa6edbc7e2e.zip
Includes TODO comment for hypot lint
-rw-r--r--tests/ui/floating_point_hypot.fixed5
-rw-r--r--tests/ui/floating_point_hypot.rs3
-rw-r--r--tests/ui/floating_point_hypot.stderr10
3 files changed, 6 insertions, 12 deletions
diff --git a/tests/ui/floating_point_hypot.fixed b/tests/ui/floating_point_hypot.fixed
index f90695bc3fe..bbe411b3f48 100644
--- a/tests/ui/floating_point_hypot.fixed
+++ b/tests/ui/floating_point_hypot.fixed
@@ -1,5 +1,5 @@
 // run-rustfix
-#![warn(clippy::suboptimal_flops, clippy::imprecise_flops)]
+#![warn(clippy::imprecise_flops)]
 
 fn main() {
     let x = 3f32;
@@ -8,6 +8,7 @@ fn main() {
     let _ = (x + 1f32).hypot(y);
     let _ = x.hypot(y);
     // Cases where the lint shouldn't be applied
+    // TODO: linting this adds some complexity, but could be done
     let _ = x.mul_add(x, y * y).sqrt();
-    let _ = x.mul_add(4f32, y * y).sqrt();
+    let _ = (x * 4f32 + y * y).sqrt();
 }
diff --git a/tests/ui/floating_point_hypot.rs b/tests/ui/floating_point_hypot.rs
index e7b048e262f..586fd170ea1 100644
--- a/tests/ui/floating_point_hypot.rs
+++ b/tests/ui/floating_point_hypot.rs
@@ -1,5 +1,5 @@
 // run-rustfix
-#![warn(clippy::suboptimal_flops, clippy::imprecise_flops)]
+#![warn(clippy::imprecise_flops)]
 
 fn main() {
     let x = 3f32;
@@ -8,6 +8,7 @@ fn main() {
     let _ = ((x + 1f32) * (x + 1f32) + y * y).sqrt();
     let _ = (x.powi(2) + y.powi(2)).sqrt();
     // Cases where the lint shouldn't be applied
+    // TODO: linting this adds some complexity, but could be done
     let _ = x.mul_add(x, y * y).sqrt();
     let _ = (x * 4f32 + y * y).sqrt();
 }
diff --git a/tests/ui/floating_point_hypot.stderr b/tests/ui/floating_point_hypot.stderr
index fe1dfc7a451..42069d9ee9e 100644
--- a/tests/ui/floating_point_hypot.stderr
+++ b/tests/ui/floating_point_hypot.stderr
@@ -18,13 +18,5 @@ error: hypotenuse can be computed more accurately
 LL |     let _ = (x.powi(2) + y.powi(2)).sqrt();
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.hypot(y)`
 
-error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_hypot.rs:12:13
-   |
-LL |     let _ = (x * 4f32 + y * y).sqrt();
-   |             ^^^^^^^^^^^^^^^^^^ help: consider using: `x.mul_add(4f32, y * y)`
-   |
-   = note: `-D clippy::suboptimal-flops` implied by `-D warnings`
-
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors