rust/tests/ui/overflow_check_conditional.rs

27 lines
516 B
Rust
Raw Normal View History

2018-07-28 17:34:52 +02:00
#![allow(clippy::many_single_char_names)]
#![warn(clippy::overflow_check_conditional)]
2016-03-06 16:01:17 +01:00
fn main() {
2018-12-09 23:26:16 +01:00
let a: u32 = 1;
let b: u32 = 2;
let c: u32 = 3;
if a + b < a {}
if a > a + b {}
if a + b < b {}
if b > a + b {}
if a - b > b {}
if b < a - b {}
if a - b > a {}
if a < a - b {}
if a + b < c {}
if c > a + b {}
if a - b < c {}
if c > a - b {}
let i = 1.1;
let j = 2.2;
if i + j < i {}
if i - j < i {}
if i > i + j {}
if i - j < i {}
2016-03-06 16:01:17 +01:00
}