]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/zero_div_zero.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / zero_div_zero.rs
CommitLineData
abe05a73
XL
1
2
ea8adc8c
XL
3
4#[allow(unused_variables)]
5#[warn(zero_divided_by_zero)]
6fn main() {
7 let nan = 0.0 / 0.0;
8 let f64_nan = 0.0 / 0.0f64;
9 let other_f64_nan = 0.0f64 / 0.0;
10 let one_more_f64_nan = 0.0f64/0.0f64;
11 let zero = 0.0;
12 let other_zero = 0.0;
13 let other_nan = zero / other_zero; // fine - this lint doesn't propegate constants.
14 let not_nan = 2.0/0.0; // not an error: 2/0 = inf
15 let also_not_nan = 0.0/2.0; // not an error: 0/2 = 0
16}