]> git.lizzy.rs Git - rust.git/blob - tests/ui/overflow_check_conditional.rs
Merge pull request #3265 from mikerite/fix-export
[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
11 #![feature(tool_lints)]
12
13
14 #![allow(clippy::many_single_char_names)]
15 #![warn(clippy::overflow_check_conditional)]
16
17 fn main() {
18         let a: u32 = 1;
19         let b: u32 = 2;
20         let c: u32 = 3;
21         if a + b < a {
22
23         }
24         if a > a + b {
25
26         }
27         if a + b < b {
28
29         }
30         if b > a + b {
31
32         }
33         if a - b > b {
34
35         }
36         if b < a - b {
37
38         }
39         if a - b > a {
40
41         }
42         if a < a - b {
43
44         }
45         if a + b < c {
46
47         }
48         if c > a + b {
49
50         }
51         if a - b < c {
52
53         }
54         if c > a - b {
55
56         }
57         let i = 1.1;
58         let j = 2.2;
59         if i + j < i {
60
61         }
62         if i - j < i {
63
64         }
65         if i > i + j {
66
67         }
68         if i - j < i {
69
70         }
71 }