-
Notifications
You must be signed in to change notification settings - Fork 961
Open
Labels
A-commentsArea: commentsArea: commentsI-trailing-whitespaceIssue: internal error; left behind trailing whitespaceIssue: internal error; left behind trailing whitespaceonly-with-optionRequires a non-default option value to reproduceRequires a non-default option value to reproduce
Description
When format_code_in_doc_comments is enabled, rustfmt will delete trailing blank lines in non-rust code blocks (e.g. blocks prefaced with ```text), and add a trailing whitespace to leading blank lines.
/// A doc comment.
///
/// ```text
///
/// A text block
///
/// ```
///
/// ^ A blank line
struct S;Formatting this, with latest nightly rustfmt as of today (rustfmt 1.8.0-nightly (9982d6462b 2025-07-20)), and the format_code_in_doc_comments option, will delete the trailing blank line in the text block, and add a trailing whitespace to the leading blank line.
Metadata
Metadata
Assignees
Labels
A-commentsArea: commentsArea: commentsI-trailing-whitespaceIssue: internal error; left behind trailing whitespaceIssue: internal error; left behind trailing whitespaceonly-with-optionRequires a non-default option value to reproduceRequires a non-default option value to reproduce