]> git.lizzy.rs Git - rust.git/blob - tests/ui/zero_div_zero.rs
Merge pull request #2984 from flip1995/single_char_pattern
[rust.git] / tests / ui / zero_div_zero.rs
1
2
3
4 #[allow(unused_variables)]
5 #[warn(zero_divided_by_zero)]
6 fn 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 }