Skip to content

Fix replacing for loops over ranges with for_each. - #10139

Merged
bors[bot] merged 2 commits into
rust-lang:masterfrom
yotamofek:fix-replace-for-loop-over-range
Sep 3, 2021
Merged

bors[bot] merged 2 commits into
rust-lang:masterfrom
yotamofek:fix-replace-for-loop-over-range

Conversation

@yotamofek

@yotamofek yotamofek commented Sep 3, 2021 •

Copy link
Copy Markdown
Contributor

Previously, the assist would turn this:

for x in 0..92 {
    ...
}

into the syntactically incorrect code below:

0..92.for_each(|x| ...)

This fixes the assist by parenthesizing range expressions.

@yotamofek

Copy link
Copy Markdown
Contributor Author

This partially fixes #8367

Comment thread crates/ide_assists/src/handlers/replace_for_loop_with_for_each.rs Outdated
@matklad

matklad commented Sep 3, 2021

Copy link
Copy Markdown
Contributor

👍

bors d+

@bors

bors Bot commented Sep 3, 2021

Copy link
Copy Markdown
Contributor

✌️ yotamofek can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
@yotamofek

Copy link
Copy Markdown
Contributor Author

bors r+

@bors

bors Bot commented Sep 3, 2021

Copy link
Copy Markdown
Contributor

@bors
bors Bot merged commit 5506e0d into rust-lang:master Sep 3, 2021
@lnicola

lnicola commented Sep 3, 2021

Copy link
Copy Markdown
Member

changelog fix (first contribution) fix for loop to for_each conversion with range expressions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants