-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #7607 - dswij:mut-range-bound-break, r=flip1995
`mut_range_bound` check for immediate break after mutation closes #7532 `mut_range_bound` ignores mutation on range bounds that is placed immediately before break. Still warns if the break is not always reachable. changelog: [`mut_range_bound`] ignore range bound mutations before immediate break
- Loading branch information
Showing
4 changed files
with
158 additions
and
41 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
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,34 +1,59 @@ | ||
error: attempt to mutate range bound within loop; note that the range of the loop is unchanged | ||
--> $DIR/mut_range_bound.rs:16:9 | ||
error: attempt to mutate range bound within loop | ||
--> $DIR/mut_range_bound.rs:8:9 | ||
| | ||
LL | m = 5; | ||
| ^ | ||
| | ||
= note: `-D clippy::mut-range-bound` implied by `-D warnings` | ||
= note: the range of the loop is unchanged | ||
|
||
error: attempt to mutate range bound within loop; note that the range of the loop is unchanged | ||
--> $DIR/mut_range_bound.rs:23:9 | ||
error: attempt to mutate range bound within loop | ||
--> $DIR/mut_range_bound.rs:15:9 | ||
| | ||
LL | m *= 2; | ||
| ^ | ||
| | ||
= note: the range of the loop is unchanged | ||
|
||
error: attempt to mutate range bound within loop; note that the range of the loop is unchanged | ||
--> $DIR/mut_range_bound.rs:31:9 | ||
error: attempt to mutate range bound within loop | ||
--> $DIR/mut_range_bound.rs:23:9 | ||
| | ||
LL | m = 5; | ||
| ^ | ||
| | ||
= note: the range of the loop is unchanged | ||
|
||
error: attempt to mutate range bound within loop; note that the range of the loop is unchanged | ||
--> $DIR/mut_range_bound.rs:32:9 | ||
error: attempt to mutate range bound within loop | ||
--> $DIR/mut_range_bound.rs:24:9 | ||
| | ||
LL | n = 7; | ||
| ^ | ||
| | ||
= note: the range of the loop is unchanged | ||
|
||
error: attempt to mutate range bound within loop; note that the range of the loop is unchanged | ||
--> $DIR/mut_range_bound.rs:46:22 | ||
error: attempt to mutate range bound within loop | ||
--> $DIR/mut_range_bound.rs:38:22 | ||
| | ||
LL | let n = &mut m; // warning | ||
| ^ | ||
| | ||
= note: the range of the loop is unchanged | ||
|
||
error: attempt to mutate range bound within loop | ||
--> $DIR/mut_range_bound.rs:70:9 | ||
| | ||
LL | m = 2; // warning because it is not immediately followed by break | ||
| ^ | ||
| | ||
= note: the range of the loop is unchanged | ||
|
||
error: attempt to mutate range bound within loop | ||
--> $DIR/mut_range_bound.rs:79:13 | ||
| | ||
LL | n = 1; // FIXME: warning because is is not immediately followed by break | ||
| ^ | ||
| | ||
= note: the range of the loop is unchanged | ||
|
||
error: aborting due to 5 previous errors | ||
error: aborting due to 7 previous errors | ||
|