Skip to content

Add extract_assignment assist #7130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 2, 2021
Merged

Conversation

Jesse-Bakker
Copy link
Contributor

@Jesse-Bakker Jesse-Bakker commented Jan 2, 2021

Add extract-assignment assist (#7006).

Assist is for now only implemented on if/match-statements where the assigment is the last statement in every block,
as for other cases, one would have to check whether the assignment has effects on the rest of the block and
extract a temporary variable for it in the block.

@Jesse-Bakker Jesse-Bakker force-pushed the extract-assignment branch 2 times, most recently from dccf19d to 3e2159a Compare January 2, 2021 01:08
@Jesse-Bakker Jesse-Bakker changed the title Add extract-assignment assist Add extract_assignment assist Jan 2, 2021
@Jesse-Bakker Jesse-Bakker force-pushed the extract-assignment branch 2 times, most recently from a449402 to 22c3a62 Compare January 2, 2021 14:35
@Jesse-Bakker
Copy link
Contributor Author

Added support for match. Getting correct indentation is a bit of a PITA and I'm not sure if I did it correctly

@Veykril
Copy link
Member

Veykril commented Jan 2, 2021

Yes indentation is an unsolved problem still iirc hence why its not so nice to do for now. Ideally we would be able to just format the produced syntax but thats yet to be done.

LGTM overall, just a small nit left, if that doesn't work as I imagined feel free to ignore it.
bors d+

@bors
Copy link
Contributor

bors bot commented Jan 2, 2021

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

@Jesse-Bakker
Copy link
Contributor Author

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 2, 2021

@bors bors bot merged commit 510abef into rust-lang:master Jan 2, 2021
@matklad
Copy link
Member

matklad commented Jan 3, 2021

See #4182 for indent.

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