Skip to content

format_code_in_doc_comments adds empty line between trailing comment and hidden code #6612

@jdygert-spok

Description

@jdygert-spok
/// ```
/// println!("1"); // comment
/// # println!("2")
/// ```

becomes

/// ```
/// println!("1"); // comment
///
/// # println!("2")
/// ```

rustfmt 1.8.0-nightly (9748d87dc7 2025-07-21)

Parent: #3348

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-commentsArea: commentsA-whitespaceArea: whitespace and its handlingC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-poor-formattingIssue: poor formattingUO-format_code_in_doc_commentsUnstable option: format_code_in_doc_comments

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions