]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/zero_div_zero.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / zero_div_zero.rs
CommitLineData
064997fb 1#[allow(unused_variables, clippy::eq_op)]
f20569fa
XL
2#[warn(clippy::zero_divided_by_zero)]
3fn 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}