]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/floating_point_powi.rs
Auto merge of #102536 - scottmcm:lookup_line-tweak, r=jackh726
[rust.git] / src / tools / clippy / tests / ui / floating_point_powi.rs
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.powi(2) + y;
11     let _ = x.powi(2) - y;
12     let _ = x + y.powi(2);
13     let _ = x - y.powi(2);
14     let _ = x + (y as f32).powi(2);
15     let _ = (x.powi(2) + y).sqrt();
16     let _ = (x + y.powi(2)).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 }