-
Notifications
You must be signed in to change notification settings - Fork 987
Open
Labels
A-commentsArea: commentsArea: commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-trailing-whitespaceIssue: internal error; left behind trailing whitespaceIssue: internal error; left behind trailing whitespaceUO-format_code_in_doc_commentsUnstable option: format_code_in_doc_commentsUnstable option: format_code_in_doc_commentsonly-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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-commentsArea: commentsArea: commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-trailing-whitespaceIssue: internal error; left behind trailing whitespaceIssue: internal error; left behind trailing whitespaceUO-format_code_in_doc_commentsUnstable option: format_code_in_doc_commentsUnstable option: format_code_in_doc_commentsonly-with-optionRequires a non-default option value to reproduceRequires a non-default option value to reproduce