]> git.lizzy.rs Git - rust.git/blob - tests/ui/mul_add_fixable.rs
Auto merge of #4809 - iankronquist:patch-1, r=flip1995
[rust.git] / tests / ui / mul_add_fixable.rs
1 // run-rustfix
2
3 #![warn(clippy::manual_mul_add)]
4 #![allow(unused_variables)]
5
6 fn mul_add_test() {
7     let a: f64 = 1234.567;
8     let b: f64 = 45.67834;
9     let c: f64 = 0.0004;
10
11     // Auto-fixable examples
12     let test1 = a * b + c;
13     let test2 = c + a * b;
14
15     let test3 = (a * b) + c;
16     let test4 = c + (a * b);
17
18     let test5 = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c;
19     let test6 = 1234.567_f64 * 45.67834_f64 + 0.0004_f64;
20 }
21
22 fn main() {
23     mul_add_test();
24 }