Skip to content
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

fixed => () to => {} #4216

Closed
wants to merge 0 commits into from
Closed

fixed => () to => {} #4216

wants to merge 0 commits into from

Conversation

lukebhan
Copy link
Contributor

This solves issue #4065. It only is really 3 lines in matches.rs, but the other files need to be changed as they all include some sort of => ().

Copy link
Contributor

@topecongiro topecongiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

Could you make sure that the trailing comma is added when match_block_trailing_comma is set to true?

@lukebhan
Copy link
Contributor Author

lukebhan commented May 31, 2020

I am having some issues with this trailing comma. If I just change the body_str instead of the match statement with something like

if body_str == "()" {
    body_str = "{}";
}

then the target file with the comma:

match {
    1 => {},
}

will be told by rustfmt to remove the comma, but then the source file wont match since the source file yields

match {
    1 => {},
} 

because rustfmt must treat () differently then {}. Do you have any ideas on where to start to solve this issue? Maybe by looking at ExprKind::tup ? in match arms. I'm not really sure.

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.

2 participants