Skip to content

Rustfmt duplicate associated type bound in the presence of comment #6234

Open
@sgdxbc

Description

@sgdxbc

I tried this code:

trait Foo {
    type Bar<'a>: Baz1 // 
     where Self: 'a;
}

Run rustfmt

trait Foo {
    type Bar<'a>: Baz1
    : Baz1 //
    where
        Self: 'a;
}

Can reproduce without <'a>, but the code would be pointless in that case.

Somewhat related: comment is discarded

trait Foo {
    type Bar: Baz1 // what
    ;
}

Run rustfmt

trait Foo {
    type Bar: Baz1;
}

Meta

rustfmt 1.7.1-nightly (35b658f 2024-07-08)
Backtrace

<backtrace>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions