]> git.lizzy.rs Git - rust.git/blob - tests/ui/floating_point_powi.rs
Auto merge of #85538 - r00ster91:iterrepeat, r=Mark-Simulacrum
[rust.git] / tests / ui / floating_point_powi.rs
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.powi(2) + y;
10     let _ = x + y.powi(2);
11     let _ = (x.powi(2) + y).sqrt();
12     let _ = (x + y.powi(2)).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 }