Skip to content

Rustfmt breaks trait method when where clause is commented out #4646

@vallentin

Description

@vallentin

In short, if you comment out the where clause, then the subsequent semicolon is moved into the comment.

Which of course breaks the code.

Before:

trait Foo {
    fn bar(&self)
    // where
    //     Self: Bar
    ;
}

After:

trait Foo {
    fn bar(&self)
    // where
    //     Self: Bar;
}

rustfmt 1.4.25-stable (0f29ff6 2020-11-11)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions