forked from rust-lang/rust-clippy
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#4730 - yerke:fix-check_infinite_loop, r=fli…
…p1995 Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body changelog: Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body fixes rust-lang#4648
- Loading branch information
Showing
3 changed files
with
109 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,95 @@ | ||
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. | ||
error: variables in the condition are not mutated in the loop body | ||
--> $DIR/infinite_loop.rs:23:11 | ||
| | ||
LL | while y < 10 { | ||
| ^^^^^^ | ||
| | ||
= note: `#[deny(clippy::while_immutable_condition)]` on by default | ||
= note: this may lead to an infinite or to a never running loop | ||
|
||
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. | ||
error: variables in the condition are not mutated in the loop body | ||
--> $DIR/infinite_loop.rs:28:11 | ||
| | ||
LL | while y < 10 && x < 3 { | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: this may lead to an infinite or to a never running loop | ||
|
||
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. | ||
error: variables in the condition are not mutated in the loop body | ||
--> $DIR/infinite_loop.rs:35:11 | ||
| | ||
LL | while !cond { | ||
| ^^^^^ | ||
| | ||
= note: this may lead to an infinite or to a never running loop | ||
|
||
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. | ||
error: variables in the condition are not mutated in the loop body | ||
--> $DIR/infinite_loop.rs:79:11 | ||
| | ||
LL | while i < 3 { | ||
| ^^^^^ | ||
| | ||
= note: this may lead to an infinite or to a never running loop | ||
|
||
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. | ||
error: variables in the condition are not mutated in the loop body | ||
--> $DIR/infinite_loop.rs:84:11 | ||
| | ||
LL | while i < 3 && j > 0 { | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: this may lead to an infinite or to a never running loop | ||
|
||
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. | ||
error: variables in the condition are not mutated in the loop body | ||
--> $DIR/infinite_loop.rs:88:11 | ||
| | ||
LL | while i < 3 { | ||
| ^^^^^ | ||
| | ||
= note: this may lead to an infinite or to a never running loop | ||
|
||
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. | ||
error: variables in the condition are not mutated in the loop body | ||
--> $DIR/infinite_loop.rs:103:11 | ||
| | ||
LL | while i < 3 { | ||
| ^^^^^ | ||
| | ||
= note: this may lead to an infinite or to a never running loop | ||
|
||
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. | ||
error: variables in the condition are not mutated in the loop body | ||
--> $DIR/infinite_loop.rs:108:11 | ||
| | ||
LL | while i < 3 { | ||
| ^^^^^ | ||
| | ||
= note: this may lead to an infinite or to a never running loop | ||
|
||
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. | ||
error: variables in the condition are not mutated in the loop body | ||
--> $DIR/infinite_loop.rs:174:15 | ||
| | ||
LL | while self.count < n { | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: this may lead to an infinite or to a never running loop | ||
|
||
error: variables in the condition are not mutated in the loop body | ||
--> $DIR/infinite_loop.rs:182:11 | ||
| | ||
LL | while y < 10 { | ||
| ^^^^^^ | ||
| | ||
= note: this may lead to an infinite or to a never running loop | ||
= note: this loop contains `return`s or `break`s | ||
= help: rewrite it as `if cond { loop { } }` | ||
|
||
error: variables in the condition are not mutated in the loop body | ||
--> $DIR/infinite_loop.rs:189:11 | ||
| | ||
LL | while y < 10 { | ||
| ^^^^^^ | ||
| | ||
= note: this may lead to an infinite or to a never running loop | ||
= note: this loop contains `return`s or `break`s | ||
= help: rewrite it as `if cond { loop { } }` | ||
|
||
error: aborting due to 9 previous errors | ||
error: aborting due to 11 previous errors | ||
|