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

Format attributes on stmt and single line block #1814

Closed
wants to merge 6 commits into from

Conversation

topecongiro
Copy link
Contributor

This PR adds an implementation to format attributes on statements and single line block.
Closes #1813.

While trying to solve #1813, I found that rustfmt removes attributes on top of a single line block.
Unfortunately, since do is not covered in the span from rust parser for do catch, there are some dirty hacks when we must use span.

@nrc
Copy link
Member

nrc commented Jul 24, 2017

Unfortunately, since do is not covered in the span from rust parser for do catch, there are some dirty hacks when we must use span.

This looks pretty easy to fix in libsyntax - I'm testing a PR at the moment, and hopefully that should land in a few days. Should we wait for that and land a 'nicer' version of this? Or just go ahead and land the current version?

assert!(
!diff.is_empty(),
"Empty diff? Maybe due to a missing a newline at the end of a file?"
);
Copy link
Member

Choose a reason for hiding this comment

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

Should this be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a mistake, sorry.

@topecongiro
Copy link
Contributor Author

I would rather wait until the rust-lang/rust#43463 lands and create a better PR.

@topecongiro topecongiro deleted the attr-on-stmt branch May 23, 2018 15:24
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