]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/zero_div_zero.rs
09db130a764315b5c2227c928d5c637cdbef6a71
[rustc.git] / src / tools / clippy / tests / ui / zero_div_zero.rs
1 #[allow(unused_variables)]
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 propegate 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 }