Skip to content

Empty line after comment is removed #3716

Open
@jplatte

Description

@jplatte

When there is an empty line after a comment in a struct declaration or struct literal, it is removed. This happened to me in a struct where fields are grouped logically, as in this example:

struct MyStruct {
    field1: String,
    field2: usize,
    field3: MyType,
    // This group ends here, and I want this comment to be attached to its end

    field4: f64,
    field5: f64,
    field6: f64,
}

Running rustfmt on the code above removes the empty line, destroying the logical grouping of the fields.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions