Skip to content

Implement reformat of tuple litterals #85

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 3 commits into from
May 31, 2015
Merged

Conversation

cassiersg
Copy link
Contributor

No description provided.

.enumerate()
.map(|(i, item)| self.rewrite_expr(
item,
// for last line, -2 is for indent + ")", for other lines, -1 is for comma
Copy link
Member

Choose a reason for hiding this comment

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

I think the 'other lines' should also be -2 because they are also offset by the opening (

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed.

@nrc
Copy link
Member

nrc commented May 29, 2015

Do you handle tuples with len == 1 properly? These should be formatted as (foo,) rather than (foo). This might require a new SeperatorTactic. It'll need a test in any case.

Otherwise, this looks good!

@cassiersg
Copy link
Contributor Author

I simply added a special case for tuples of length 1, the general algo is not adapted because width - 3 is needed to get comma and paren on same line.

nrc added a commit that referenced this pull request May 31, 2015
Implement reformat of tuple litterals
@nrc nrc merged commit fb40a27 into rust-lang:master May 31, 2015
@marcusklaas marcusklaas mentioned this pull request Jun 1, 2015
@cassiersg cassiersg deleted the tuple branch June 8, 2015 14:41
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