Skip to content

Remove empty type parameters on trait definitions. #858

Closed
@Stebalien

Description

@Stebalien

Stealing this test case: rust-lang/rust#32023

trait T<> {} should be formatted to trait T {} to be consistent. That is, the following:

struct S<>;
trait T<> {}
enum E<> { V }
impl<> T<> for S<> {}
impl T for E {}
fn foo<>() {}
fn bar() {}

fn main() {
    let _ = S;
    let _ = S::<>;
    let _ = E::V;
    let _ = E::<>::V;
    foo();
    foo::<>();

    // Test that we can supply <> to non generic things
    bar::<>();
    let _: i32<>;
}

Currently gets transformed to:

struct S;
trait T<> {}
enum E {
    V,
}
impl T for S {}
impl T for E {}
fn foo() {}
fn bar() {}

fn main() {
    let _ = S;
    let _ = S;
    let _ = E::V;
    let _ = E::V;
    foo();
    foo();

    // Test that we can supply <> to non generic things
    bar();
    let _: i32;
}

But the second line should be trait T {}.

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