close
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

Fix replacing for loops over ranges with for_each.#10139
bors[bot] merged 2 commits into
rust-lang:masterfrom
yotamofek:fix-replace-for-loop-over-range

Conversation

@yotamofek
Copy link
Copy Markdown
Contributor

@yotamofek yotamofek commented Sep 3, 2021

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
Copy link
Copy Markdown
Contributor

matklad commented Sep 3, 2021

👍

bors d+

@bors
Copy link
Copy Markdown
Contributor

bors Bot commented Sep 3, 2021

✌️ 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
Copy link
Copy Markdown
Contributor

bors Bot commented Sep 3, 2021

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

lnicola commented Sep 3, 2021

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