-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reclassify powi(2) lint under suboptimal_flops
- Loading branch information
1 parent
ace14d3
commit 0729c8c
Showing
4 changed files
with
75 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,40 @@ | ||
error: square can be computed more accurately | ||
error: square can be computed more efficiently | ||
--> $DIR/floating_point_powi.rs:7:13 | ||
| | ||
LL | let _ = x.powi(2); | ||
| ^^^^^^^^^ help: consider using: `x * x` | ||
| | ||
= note: `-D clippy::imprecise-flops` implied by `-D warnings` | ||
= note: `-D clippy::suboptimal-flops` implied by `-D warnings` | ||
|
||
error: square can be computed more accurately | ||
error: square can be computed more efficiently | ||
--> $DIR/floating_point_powi.rs:8:13 | ||
| | ||
LL | let _ = x.powi(1 + 1); | ||
| ^^^^^^^^^^^^^ help: consider using: `x * x` | ||
|
||
error: square can be computed more accurately | ||
--> $DIR/floating_point_powi.rs:11:14 | ||
error: square can be computed more efficiently | ||
--> $DIR/floating_point_powi.rs:11:13 | ||
| | ||
LL | let _ = (x.powi(2) + y).sqrt(); | ||
| ^^^^^^^^^ help: consider using: `x * x` | ||
LL | let _ = x.powi(2) + y; | ||
| ^^^^^^^^^^^^^ help: consider using: `x.mul_add(x, y)` | ||
|
||
error: square can be computed more accurately | ||
--> $DIR/floating_point_powi.rs:12:18 | ||
error: square can be computed more efficiently | ||
--> $DIR/floating_point_powi.rs:12:13 | ||
| | ||
LL | let _ = (x + y.powi(2)).sqrt(); | ||
| ^^^^^^^^^ help: consider using: `y * y` | ||
LL | let _ = x + y.powi(2); | ||
| ^^^^^^^^^^^^^ help: consider using: `y.mul_add(y, x)` | ||
|
||
error: square can be computed more efficiently | ||
--> $DIR/floating_point_powi.rs:13:13 | ||
| | ||
LL | let _ = (x.powi(2) + y).sqrt(); | ||
| ^^^^^^^^^^^^^^^ help: consider using: `x.mul_add(x, y)` | ||
|
||
error: hypotenuse can be computed more accurately | ||
--> $DIR/floating_point_powi.rs:16:13 | ||
error: square can be computed more efficiently | ||
--> $DIR/floating_point_powi.rs:14:13 | ||
| | ||
LL | let _ = (x.powi(2) + y.powi(2)).sqrt(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.hypot(y)` | ||
LL | let _ = (x + y.powi(2)).sqrt(); | ||
| ^^^^^^^^^^^^^^^ help: consider using: `y.mul_add(y, x)` | ||
|
||
error: aborting due to 5 previous errors | ||
error: aborting due to 6 previous errors | ||
|