]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/floating_point_exp.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / floating_point_exp.rs
CommitLineData
f20569fa
XL
1// run-rustfix
2#![warn(clippy::imprecise_flops)]
2b03887a 3#![allow(clippy::unnecessary_cast)]
f20569fa
XL
4
5fn main() {
6 let x = 2f32;
7 let _ = x.exp() - 1.0;
8 let _ = x.exp() - 1.0 + 2.0;
f2b60f7d 9 let _ = (x as f32).exp() - 1.0 + 2.0;
f20569fa
XL
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}