]> git.lizzy.rs Git - rust.git/blob - tests/ui/needless_continue.rs
Adapt the *.stderr files of the ui-tests to the tool_lints
[rust.git] / tests / ui / needless_continue.rs
1 #![feature(tool_lints)]
2
3
4 macro_rules! zero {
5     ($x:expr) => ($x == 0);
6 }
7
8 macro_rules! nonzero {
9     ($x:expr) => (!zero!($x));
10 }
11
12 #[warn(clippy::needless_continue)]
13 fn main() {
14     let mut i = 1;
15     while i < 10 {
16         i += 1;
17
18         if i % 2 == 0 && i % 3 == 0 {
19             println!("{}", i);
20             println!("{}", i+1);
21             if i % 5 == 0 {
22                 println!("{}", i+2);
23             }
24             let i = 0;
25             println!("bar {} ", i);
26         } else {
27             continue;
28         }
29
30         println!("bleh");
31         {
32             println!("blah");
33         }
34
35         // some comments that also should ideally be included in the
36         // output of the lint suggestion if possible.
37         if !(!(i == 2) || !(i == 5)) {
38             println!("lama");
39         }
40
41         if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
42             continue;
43         } else {
44             println!("Blabber");
45             println!("Jabber");
46         }
47
48         println!("bleh");
49     }
50 }