Open
Description
Given the following code: link
fn main() {
for i in 0.10 {
}
}
The current output is:
Compiling playground v0.0.1 (/playground)
error[[E0277]](https://doc.rust-lang.org/nightly/error-index.html#E0277): `{float}` is not an iterator
--> src/main.rs:2:14
|
2 | for i in 0.10 {
| ^^^^ `{float}` is not an iterator
|
= help: the trait `Iterator` is not implemented for `{float}`
= note: required for `{float}` to implement `IntoIterator`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground` due to previous error
Ideally the output should suggest adding a .
due to the typo. Thanks.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
estebank commentedon Sep 16, 2022
We might also want to handle the opposite case:
let _: f64 = 0..10;
.
to use a floating point literal #104144leonardo-m commentedon Nov 8, 2022
Avoiding stuff like "in 0.10 {" is why I suggested that ".." is an operator, so the standard rustfmt formatting should have spaces around it, as in "in 0 .. 20 {".
Rollup merge of rust-lang#104144 - TaKO8Ki:suggest-removing-unnecessa…
Rollup merge of rust-lang#104144 - TaKO8Ki:suggest-removing-unnecessa…
Rollup merge of rust-lang#104144 - TaKO8Ki:suggest-removing-unnecessa…
Rollup merge of rust-lang#104144 - TaKO8Ki:suggest-removing-unnecessa…
Rollup merge of rust-lang#104144 - TaKO8Ki:suggest-removing-unnecessa…