]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/floating_point_powi.fixed
Rollup merge of #102685 - nbdd0121:unwind, r=m-ou-se
[rust.git] / src / tools / clippy / tests / ui / floating_point_powi.fixed
1 // run-rustfix
2 #![warn(clippy::suboptimal_flops)]
3 #![allow(clippy::unnecessary_cast)]
4
5 fn main() {
6     let one = 1;
7     let x = 3f32;
8
9     let y = 4f32;
10     let _ = x.mul_add(x, y);
11     let _ = x.mul_add(x, -y);
12     let _ = y.mul_add(y, x);
13     let _ = y.mul_add(-y, x);
14     let _ = (y as f32).mul_add(y as f32, x);
15     let _ = x.mul_add(x, y).sqrt();
16     let _ = y.mul_add(y, x).sqrt();
17     // Cases where the lint shouldn't be applied
18     let _ = x.powi(2);
19     let _ = x.powi(1 + 1);
20     let _ = x.powi(3);
21     let _ = x.powi(4) + y;
22     let _ = x.powi(one + 1);
23     let _ = (x.powi(2) + y.powi(2)).sqrt();
24 }