]> git.lizzy.rs Git - rust.git/blob - tests/ui/floating_point_powi.rs
Auto merge of #6298 - JohnTitor:fix-example, r=llogiq
[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     let _ = x.powi(2);
8     let _ = x.powi(1 + 1);
9
10     let y = 4f32;
11     let _ = x.powi(2) + y;
12     let _ = x + y.powi(2);
13     let _ = (x.powi(2) + y).sqrt();
14     let _ = (x + y.powi(2)).sqrt();
15     // Cases where the lint shouldn't be applied
16     let _ = x.powi(3);
17     let _ = x.powi(one + 1);
18     let _ = (x.powi(2) + y.powi(2)).sqrt();
19 }