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

add newline when the last line has comment #4019

Closed
wants to merge 1 commit into from

Conversation

rchaser53
Copy link
Contributor

fix: #3988

mod a {
mod b {
///test
fn foo() -> (){
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 bug is caused by the case when the rustfmt fails to format because the width is greater than max_width in rustfmt.toml.
In this case, this line is greater than 10. rustfmt seems to remove the white space and emits the not formatted string. I think that's the reason why the implementation exists after comment on the same line.

Copy link
Member

Choose a reason for hiding this comment

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

The indentation of foo looks/feels a bit odd 🤔

I feel like we may need a slightly different solution in order to maintain the target indent (since this exceeds the max_width anyway)

@rchaser53 rchaser53 requested a review from topecongiro January 15, 2020 13:44
@rchaser53
Copy link
Contributor Author

I don't have enough time, so close this PR. Sorry.

@rchaser53 rchaser53 closed this May 13, 2020
@rchaser53 rchaser53 deleted the issue-3988 branch May 13, 2020 15:37
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.

normalize_doc_attributes sometimes comments out code
2 participants