mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +00:00
40 lines
1.5 KiB
Text
40 lines
1.5 KiB
Text
error: consider using `mul_add()` for better numerical precision
|
|
--> $DIR/mul_add_fixable.rs:12:17
|
|
|
|
|
LL | let test1 = a * b + c;
|
|
| ^^^^^^^^^ help: try: `a.mul_add(b, c)`
|
|
|
|
|
= note: `-D clippy::manual-mul-add` implied by `-D warnings`
|
|
|
|
error: consider using `mul_add()` for better numerical precision
|
|
--> $DIR/mul_add_fixable.rs:13:17
|
|
|
|
|
LL | let test2 = c + a * b;
|
|
| ^^^^^^^^^ help: try: `a.mul_add(b, c)`
|
|
|
|
error: consider using `mul_add()` for better numerical precision
|
|
--> $DIR/mul_add_fixable.rs:15:17
|
|
|
|
|
LL | let test3 = (a * b) + c;
|
|
| ^^^^^^^^^^^ help: try: `a.mul_add(b, c)`
|
|
|
|
error: consider using `mul_add()` for better numerical precision
|
|
--> $DIR/mul_add_fixable.rs:16:17
|
|
|
|
|
LL | let test4 = c + (a * b);
|
|
| ^^^^^^^^^^^ help: try: `a.mul_add(b, c)`
|
|
|
|
error: consider using `mul_add()` for better numerical precision
|
|
--> $DIR/mul_add_fixable.rs:18:17
|
|
|
|
|
LL | let test5 = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.mul_add(b, c).mul_add(a.mul_add(b, c), a.mul_add(b, c))`
|
|
|
|
error: consider using `mul_add()` for better numerical precision
|
|
--> $DIR/mul_add_fixable.rs:19:17
|
|
|
|
|
LL | let test6 = 1234.567_f64 * 45.67834_f64 + 0.0004_f64;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1234.567_f64.mul_add(45.67834_f64, 0.0004_f64)`
|
|
|
|
error: aborting due to 6 previous errors
|
|
|