mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +00:00
58 lines
2.4 KiB
Text
58 lines
2.4 KiB
Text
error: multiply and add expressions can be calculated more efficiently and accurately
|
|
--> $DIR/floating_point_mul_add.rs:10:13
|
|
|
|
|
LL | let _ = a * b + c;
|
|
| ^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
|
|
|
|
|
= note: `-D clippy::suboptimal-flops` implied by `-D warnings`
|
|
|
|
error: multiply and add expressions can be calculated more efficiently and accurately
|
|
--> $DIR/floating_point_mul_add.rs:11:13
|
|
|
|
|
LL | let _ = c + a * b;
|
|
| ^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
|
|
|
|
error: multiply and add expressions can be calculated more efficiently and accurately
|
|
--> $DIR/floating_point_mul_add.rs:12:13
|
|
|
|
|
LL | let _ = a + 2.0 * 4.0;
|
|
| ^^^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4.0, a)`
|
|
|
|
error: multiply and add expressions can be calculated more efficiently and accurately
|
|
--> $DIR/floating_point_mul_add.rs:13:13
|
|
|
|
|
LL | let _ = a + 2. * 4.;
|
|
| ^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4., a)`
|
|
|
|
error: multiply and add expressions can be calculated more efficiently and accurately
|
|
--> $DIR/floating_point_mul_add.rs:15:13
|
|
|
|
|
LL | let _ = (a * b) + c;
|
|
| ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
|
|
|
|
error: multiply and add expressions can be calculated more efficiently and accurately
|
|
--> $DIR/floating_point_mul_add.rs:16:13
|
|
|
|
|
LL | let _ = c + (a * b);
|
|
| ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
|
|
|
|
error: multiply and add expressions can be calculated more efficiently and accurately
|
|
--> $DIR/floating_point_mul_add.rs:17:13
|
|
|
|
|
LL | let _ = a * b * c + d;
|
|
| ^^^^^^^^^^^^^ help: consider using: `(a * b).mul_add(c, d)`
|
|
|
|
error: multiply and add expressions can be calculated more efficiently and accurately
|
|
--> $DIR/floating_point_mul_add.rs:19:13
|
|
|
|
|
LL | let _ = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `a.mul_add(b, c).mul_add(a.mul_add(b, c), a.mul_add(b, c))`
|
|
|
|
error: multiply and add expressions can be calculated more efficiently and accurately
|
|
--> $DIR/floating_point_mul_add.rs:20:13
|
|
|
|
|
LL | let _ = 1234.567_f64 * 45.67834_f64 + 0.0004_f64;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1234.567_f64.mul_add(45.67834_f64, 0.0004_f64)`
|
|
|
|
error: aborting due to 9 previous errors
|
|
|