]> git.lizzy.rs Git - rust.git/blob - tests/ui/floating_point_powi.rs
Lint for x.powi(2) => x * x
[rust.git] / tests / ui / floating_point_powi.rs
1 // run-rustfix
2 #![warn(clippy::suboptimal_flops, clippy::imprecise_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     // Cases where the lint shouldn't be applied
10     let _ = x.powi(3);
11     let _ = x.powi(one + 1);
12 }