-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emits suggestions for expressions with parentheses or not separately
- Loading branch information
Showing
5 changed files
with
65 additions
and
26 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,5 +1,4 @@ | ||
fn main() { | ||
for i in 0..(256 as u8) { //~ ERROR range endpoint is out of range | ||
println!("{}", i); | ||
} | ||
for _ in 0..256 as u8 {} //~ ERROR range endpoint is out of range | ||
for _ in 0..(256 as u8) {} //~ ERROR range endpoint is out of range | ||
} |
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,18 +1,23 @@ | ||
error: range endpoint is out of range for `u8` | ||
--> $DIR/issue-109529.rs:2:14 | ||
| | ||
LL | for i in 0..(256 as u8) { | ||
| ^^^^^^^^^^^^^^ | ||
LL | for _ in 0..256 as u8 {} | ||
| ------^^^^^^ | ||
| | | ||
| help: use an inclusive range instead: `0..=255` | ||
| | ||
= note: `#[deny(overflowing_literals)]` on by default | ||
help: use an inclusive range instead | ||
|
||
error: range endpoint is out of range for `u8` | ||
--> $DIR/issue-109529.rs:3:14 | ||
| | ||
LL | for _ in 0..(256 as u8) {} | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
LL | for i in 0..=(256 as u8) { | ||
| + | ||
help: use an inclusive range instead | ||
| | ||
LL | for i in 0..(255 as u8) { | ||
| ~~~ | ||
LL | for _ in 0..=(255 as u8) {} | ||
| + ~~~ | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 2 previous errors | ||
|