Skip to content

Ensure code fences are placed on their own line in doc comments #5267

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ytmimi
Copy link
Contributor

@ytmimi ytmimi commented Mar 15, 2022

Fixes #5244

When wrap_comments=true was set there was a chance that the line right before the comment would be wrapped. When this happened, rustfmt didn't place a newline between the wrapped line and the code fence. This placed the start of the code fence on the same line as the previously wrapped line.

Now, rustfmt adds a newline when necessary to ensure that code fences are placed on their own lines.

Fixes 5244

When `wrap_comments=true` was set there was a chance that the line right
before the comment would be wrapped. When this happened, rustfmt didn't
place a newline between the wrapped line and the code fence. This placed
the start of the code fence on the same line as the previously wrapped
line.

Now, rustfmt will add a newline when necessary to ensure that code
fences are placed on their own lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wrap_comments does not ensure code blocks start on a new line
2 participants