mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-01 00:49:30 +00:00
25 lines
521 B
Rust
25 lines
521 B
Rust
|
// run-rustfix
|
||
|
|
||
|
#![warn(clippy::manual_mul_add)]
|
||
|
#![allow(unused_variables)]
|
||
|
|
||
|
fn mul_add_test() {
|
||
|
let a: f64 = 1234.567;
|
||
|
let b: f64 = 45.67834;
|
||
|
let c: f64 = 0.0004;
|
||
|
|
||
|
// Auto-fixable examples
|
||
|
let test1 = a.mul_add(b, c);
|
||
|
let test2 = a.mul_add(b, c);
|
||
|
|
||
|
let test3 = a.mul_add(b, c);
|
||
|
let test4 = a.mul_add(b, c);
|
||
|
|
||
|
let test5 = a.mul_add(b, c).mul_add(a.mul_add(b, c), a.mul_add(b, c)) + c;
|
||
|
let test6 = 1234.567_f64.mul_add(45.67834_f64, 0.0004_f64);
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
mul_add_test();
|
||
|
}
|