]> git.lizzy.rs Git - rust.git/blob - tests/ui/overflow_check_conditional.rs
a5cff3df9d7e39ceb176859742243342318584a6
[rust.git] / tests / ui / overflow_check_conditional.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 #![allow(clippy::many_single_char_names)]
11 #![warn(clippy::overflow_check_conditional)]
12
13 fn main() {
14     let a: u32 = 1;
15     let b: u32 = 2;
16     let c: u32 = 3;
17     if a + b < a {}
18     if a > a + b {}
19     if a + b < b {}
20     if b > a + b {}
21     if a - b > b {}
22     if b < a - b {}
23     if a - b > a {}
24     if a < a - b {}
25     if a + b < c {}
26     if c > a + b {}
27     if a - b < c {}
28     if c > a - b {}
29     let i = 1.1;
30     let j = 2.2;
31     if i + j < i {}
32     if i - j < i {}
33     if i > i + j {}
34     if i - j < i {}
35 }