]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/floating_point_exp.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / src / tools / clippy / tests / ui / floating_point_exp.rs
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() - 1.0;
8     let _ = x.exp() - 1.0 + 2.0;
9     let _ = (x as f32).exp() - 1.0 + 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() - 1.0;
16     let _ = x.exp() - 1.0 + 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 }