-
Notifications
You must be signed in to change notification settings - Fork 936
Open
Labels
a-commentse-trailing whitespaceerror[internal]: left behind trailing whitespaceerror[internal]: 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-commentse-trailing whitespaceerror[internal]: left behind trailing whitespaceerror[internal]: left behind trailing whitespaceonly-with-optionrequires a non-default option value to reproducerequires a non-default option value to reproduce