Skip to content

comments of different indent levels alligned equally #2587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matthiaskrgr opened this issue Apr 1, 2018 · 2 comments
Closed

comments of different indent levels alligned equally #2587

matthiaskrgr opened this issue Apr 1, 2018 · 2 comments

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Apr 1, 2018

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- ( )

@bluetech
Copy link

bluetech commented Jun 23, 2018

I'm seeing this as well. My case looks like this:

Before/expected:

fn main() {
    let some_variable = 1 + 2 + 3 + 4 + 5; // A line-comment for this ← line.
    // A long multi-line comment
    // for the next ↓ line.
    let some_other_variable = 6;
}

After/actual:

fn main() {
    let some_variable = 1 + 2 + 3 + 4 + 5; // A line-comment for this ← line.
                                           // A long multi-line comment
                                           // for the next ↓ line.
    let some_other_variable = 6;
}

@nrc nrc added the p-low label Jun 24, 2018
@topecongiro
Copy link
Contributor

Closed by #3833.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants