]> git.lizzy.rs Git - rust.git/blob - tests/ui/needless_continue.stderr
Auto merge of #4478 - tsurai:master, r=flip1995
[rust.git] / tests / ui / needless_continue.stderr
1 error: This else block is redundant.
2
3   --> $DIR/needless_continue.rs:28:16
4    |
5 LL |           } else {
6    |  ________________^
7 LL | |             continue;
8 LL | |         }
9    | |_________^
10    |
11    = note: `-D clippy::needless-continue` implied by `-D warnings`
12    = help: Consider dropping the else clause and merging the code that follows (in the loop) with the if block, like so:
13            if i % 2 == 0 && i % 3 == 0 {
14            println!("{}", i);
15            println!("{}", i + 1);
16            if i % 5 == 0 {
17                println!("{}", i + 2);
18            }
19            let i = 0;
20            println!("bar {} ", i);
21            // Merged code follows...println!("bleh");
22            {
23                println!("blah");
24            }
25            if !(!(i == 2) || !(i == 5)) {
26                println!("lama");
27            }
28            if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
29                continue;
30            } else {
31                println!("Blabber");
32                println!("Jabber");
33            }
34            println!("bleh");
35            }
36            
37
38 error: There is no need for an explicit `else` block for this `if` expression
39
40   --> $DIR/needless_continue.rs:43:9
41    |
42 LL | /         if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
43 LL | |             continue;
44 LL | |         } else {
45 LL | |             println!("Blabber");
46 LL | |             println!("Jabber");
47 LL | |         }
48    | |_________^
49    |
50    = help: Consider dropping the else clause, and moving out the code in the else block, like so:
51            if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
52                continue;
53            }
54            println!("Blabber");
55            println!("Jabber");
56            ...
57
58 error: This else block is redundant.
59
60   --> $DIR/needless_continue.rs:100:24
61    |
62 LL |                   } else {
63    |  ________________________^
64 LL | |                     continue 'inner; // should lint here
65 LL | |                 }
66    | |_________________^
67    |
68    = help: Consider dropping the else clause and merging the code that follows (in the loop) with the if block, like so:
69            if condition() {
70            println!("bar-3");
71            // Merged code follows...println!("bar-4");
72            update_condition();
73            if condition() {
74                continue; // should lint here
75            } else {
76                println!("bar-5");
77            }
78            println!("bar-6");
79            }
80            
81
82 error: There is no need for an explicit `else` block for this `if` expression
83
84   --> $DIR/needless_continue.rs:106:17
85    |
86 LL | /                 if condition() {
87 LL | |                     continue; // should lint here
88 LL | |                 } else {
89 LL | |                     println!("bar-5");
90 LL | |                 }
91    | |_________________^
92    |
93    = help: Consider dropping the else clause, and moving out the code in the else block, like so:
94            if condition() {
95                continue;
96            }
97            println!("bar-5");
98            ...
99
100 error: aborting due to 4 previous errors
101