]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/floating_point_logbase.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / src / tools / clippy / tests / ui / floating_point_logbase.rs
1 // run-rustfix
2 #![warn(clippy::suboptimal_flops)]
3 #![allow(clippy::unnecessary_cast)]
4
5 fn main() {
6     let x = 3f32;
7     let y = 5f32;
8     let _ = x.ln() / y.ln();
9     let _ = (x as f32).ln() / y.ln();
10     let _ = x.log2() / y.log2();
11     let _ = x.log10() / y.log10();
12     let _ = x.log(5f32) / y.log(5f32);
13     // Cases where the lint shouldn't be applied
14     let _ = x.ln() / y.powf(3.2);
15     let _ = x.powf(3.2) / y.powf(3.2);
16     let _ = x.powf(3.2) / y.ln();
17     let _ = x.log(5f32) / y.log(7f32);
18 }