mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
327c91f8c7
Fixed typo Fixes lint name and uses appropriate linting suggestion changed lint help message Added autofixable test Added Autofixable Test Removed Broken Autofixable File updated lints Generated Autofixable/Nonfixable Test Cases Changed Suggestion Applicability Updated Lint Count
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
|
|
|