1
- error: This `else` block is redundant.
2
-
1
+ error: this `else` block is redundant
3
2
--> $DIR/needless_continue.rs:28:16
4
3
|
5
4
LL | } else {
@@ -9,34 +8,33 @@ LL | | }
9
8
| |_________^
10
9
|
11
10
= 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
+ }
39
36
37
+ error: there is no need for an explicit `else` block for this `if` expression
40
38
--> $DIR/needless_continue.rs:43:9
41
39
|
42
40
LL | / if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
@@ -47,16 +45,15 @@ LL | | println!("Jabber");
47
45
LL | | }
48
46
| |_________^
49
47
|
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
+ }
59
55
56
+ error: this `else` block is redundant
60
57
--> $DIR/needless_continue.rs:100:24
61
58
|
62
59
LL | } else {
@@ -65,22 +62,21 @@ LL | | continue 'inner; // should lint here
65
62
LL | | }
66
63
| |_________________^
67
64
|
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
+ }
83
78
79
+ error: there is no need for an explicit `else` block for this `if` expression
84
80
--> $DIR/needless_continue.rs:106:17
85
81
|
86
82
LL | / if condition() {
@@ -90,12 +86,12 @@ LL | | println!("bar-5");
90
86
LL | | }
91
87
| |_________________^
92
88
|
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
+ }
99
95
100
96
error: aborting due to 4 previous errors
101
97
0 commit comments