]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/zero_div_zero.rs
Auto merge of #99099 - Stargateur:phantomdata_debug, r=joshtriplett
[rust.git] / src / tools / clippy / tests / ui / zero_div_zero.rs
1 #[allow(unused_variables, clippy::eq_op)]
2 #[warn(clippy::zero_divided_by_zero)]
3 fn main() {
4     let nan = 0.0 / 0.0;
5     let f64_nan = 0.0 / 0.0f64;
6     let other_f64_nan = 0.0f64 / 0.0;
7     let one_more_f64_nan = 0.0f64 / 0.0f64;
8     let zero = 0.0;
9     let other_zero = 0.0;
10     let other_nan = zero / other_zero; // fine - this lint doesn't propagate constants.
11     let not_nan = 2.0 / 0.0; // not an error: 2/0 = inf
12     let also_not_nan = 0.0 / 2.0; // not an error: 0/2 = 0
13 }