-
Notifications
You must be signed in to change notification settings - Fork 1k
format_code_in_doc_comments should not touch non-rust code blocks #6609
Copy link
Copy link
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
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
Type
Fields
Give feedbackNo fields configured for issues without a type.
#3348
When
format_code_in_doc_commentsis 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.Formatting this, with latest nightly rustfmt as of today (
rustfmt 1.8.0-nightly (9982d6462b 2025-07-20)), and theformat_code_in_doc_commentsoption, will delete the trailing blank line in thetextblock, and add a trailing whitespace to the leading blank line.