1- error: This `else` block is redundant.
2-
1+ error: this `else` block is redundant
32 --> $DIR/needless_continue.rs:28:16
43 |
54LL | } else {
@@ -9,34 +8,33 @@ LL | | }
98 | |_________^
109 |
1110 = 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
11+ = help: consider dropping the `else` clause and merging the code that follows (in the loop) with the `if` block
12+ if i % 2 == 0 && i % 3 == 0 {
13+ println!("{}", i);
14+ println!("{}", i + 1);
15+ if i % 5 == 0 {
16+ println!("{}", i + 2);
17+ }
18+ let i = 0;
19+ println!("bar {} ", i);
20+ // merged code follows:
21+ 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+ }
3936
37+ error: there is no need for an explicit `else` block for this `if` expression
4038 --> $DIR/needless_continue.rs:43:9
4139 |
4240LL | / if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
@@ -47,16 +45,15 @@ LL | | println!("Jabber");
4745LL | | }
4846 | |_________^
4947 |
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.
48+ = help: consider dropping the `else` clause
49+ if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
50+ continue;
51+ } {
52+ println!("Blabber");
53+ println!("Jabber");
54+ }
5955
56+ error: this `else` block is redundant
6057 --> $DIR/needless_continue.rs:100:24
6158 |
6259LL | } else {
@@ -65,22 +62,21 @@ LL | | continue 'inner; // should lint here
6562LL | | }
6663 | |_________________^
6764 |
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
65+ = help: consider dropping the `else` clause and merging the code that follows (in the loop) with the `if` block
66+ if condition() {
67+ println!("bar-3");
68+ // merged code follows:
69+ println!("bar-4");
70+ update_condition();
71+ if condition() {
72+ continue; // should lint here
73+ } else {
74+ println!("bar-5");
75+ }
76+ println!("bar-6");
77+ }
8378
79+ error: there is no need for an explicit `else` block for this `if` expression
8480 --> $DIR/needless_continue.rs:106:17
8581 |
8682LL | / if condition() {
@@ -90,12 +86,12 @@ LL | | println!("bar-5");
9086LL | | }
9187 | |_________________^
9288 |
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- ...
89+ = help: consider dropping the `else` clause
90+ if condition() {
91+ continue; // should lint here
92+ } {
93+ println!("bar-5");
94+ }
9995
10096error: aborting due to 4 previous errors
10197
0 commit comments