-
Notifications
You must be signed in to change notification settings - Fork 888
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
Fix #5533: Prefer light_rewrite_comment if it is not a doccomment #5536
Conversation
cc @ytmimi . Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your first contribution to rustfmt 🎉
See my inline comments for thoughts on how we can simplify the PR. Let me know if you have any questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the follow up!
I still believe is_doc_comment
is the only boolean we need to include in our check to force code execution to move to light_rewrite_comment
. I could be missing something, and if we need to check both is_doc_comment
and style.is_doc_comment
could you please explain why. The comment is helpful and I liked that you kept it 👍🏼
I have reverted it. However, why did L384 do such a double check? Lines 378 to 385 in 8919fd3
Seems like this code had been refactored before, and I don't know why they wrote it. Besides, even when I removed the determination, all the tests were still passed. |
That decision predates my time with the project. My best guess is that there was a time when both were necessary to be absolutely sure we were rewriting a doc comment. Now that we have
It's might be the case that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your help on this! I think we're good to go here but will hold off on merging to give @calebcartwright a chance to take a look.
Hey folks, I think this PR has the ready to merge label and it resolves several issues with formatting comments. What else needs to be done to get this merged? |
@pan93412 thanks again for your help on this one. This fixes a few issues so I'm going to merge. |
Thank you. |
This pull request adapts the plan 2 of @ytmimi's comment, and it won't touch any comment which is not a documentation comment now.
However, it did not fixed the root cause (which is partially indicated in Plan 1):
block_comment
istrue
if the length is too long…?. As it seems not related to #5533, it may be fixed in another PR.