]> git.lizzy.rs Git - rust.git/blob - tests/ui/floating_point_powi.fixed
Auto merge of #7847 - mikerite:fix-7829, r=flip1995
[rust.git] / tests / ui / floating_point_powi.fixed
1 // run-rustfix
2 #![warn(clippy::suboptimal_flops)]
3
4 fn main() {
5     let one = 1;
6     let x = 3f32;
7
8     let y = 4f32;
9     let _ = x.mul_add(x, y);
10     let _ = y.mul_add(y, x);
11     let _ = x.mul_add(x, y).sqrt();
12     let _ = y.mul_add(y, x).sqrt();
13     // Cases where the lint shouldn't be applied
14     let _ = x.powi(2);
15     let _ = x.powi(1 + 1);
16     let _ = x.powi(3);
17     let _ = x.powi(4) + y;
18     let _ = x.powi(one + 1);
19     let _ = (x.powi(2) + y.powi(2)).sqrt();
20 }