]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/floating_point_hypot.rs
Rollup merge of #78769 - est31:remove_lifetimes, r=KodrAus
[rust.git] / src / tools / clippy / tests / ui / floating_point_hypot.rs
1 // run-rustfix
2 #![warn(clippy::imprecise_flops)]
3
4 fn main() {
5     let x = 3f32;
6     let y = 4f32;
7     let _ = (x * x + y * y).sqrt();
8     let _ = ((x + 1f32) * (x + 1f32) + y * y).sqrt();
9     let _ = (x.powi(2) + y.powi(2)).sqrt();
10     // Cases where the lint shouldn't be applied
11     // TODO: linting this adds some complexity, but could be done
12     let _ = x.mul_add(x, y * y).sqrt();
13     let _ = (x * 4f32 + y * y).sqrt();
14 }