Skip to content

comments of different indent levels alligned equally #2587

Closed
@matthiaskrgr

Description

@matthiaskrgr

Hi, I like comment closing brackets of conditions with condition to easily see what a indent level implies, sorta like this

pub fn main() {
    let x = 5;

    if x == 3 {
        x = 4;

        /*
        a
        lot
        of
        code
        ...
        */
    } // if x == 3
    // end of block
}

If I put another comment right after the end of the basic block/curly bracket, rustfmt will align the two comments equally altough the comments refer to different scopes:

    } // if x == 3
      // end of block

is there a way to disable comment alignment for this case?

edit: rustfmt 0.4.1- ( )

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