]> git.lizzy.rs Git - rust.git/blob - tests/ui/floating_point_exp.fixed
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / floating_point_exp.fixed
1 // run-rustfix
2 #![warn(clippy::imprecise_flops)]
3 #![allow(clippy::unnecessary_cast)]
4
5 fn main() {
6     let x = 2f32;
7     let _ = x.exp_m1();
8     let _ = x.exp_m1() + 2.0;
9     let _ = (x as f32).exp_m1() + 2.0;
10     // Cases where the lint shouldn't be applied
11     let _ = x.exp() - 2.0;
12     let _ = x.exp() - 1.0 * 2.0;
13
14     let x = 2f64;
15     let _ = x.exp_m1();
16     let _ = x.exp_m1() + 2.0;
17     // Cases where the lint shouldn't be applied
18     let _ = x.exp() - 2.0;
19     let _ = x.exp() - 1.0 * 2.0;
20 }