Skip to content

Comment indentation is always changed #3254

Closed
@mqudsi

Description

@mqudsi

With both normalize_comments and wrap_comments disabled, the following code is mangled:

fn foo {
    let f = bar(); // comment for this line
    // some comment here to describe the next line
    let b = baz();
}

Which gets "corrected" to the following:

fn foo {
    let f = bar(); // comment for this line
                   // some comment here to describe the next line
    let b = baz();
}

Also,

fn foo {
    let f = bar(); // comment for this line
    // let b = baz();
}

Gets equally transformed to

fn foo {
    let f = bar(); // comment for this line
                   // let b = baz();
}

Note that I expect neither wrap_comments nor normalize_comments to do this.

Suggested fix: if the comment on the next line starts at index 0, do not try to align them.
See also #2949, which was fixed.

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