rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Add auto trait name for generate_trait_from_impl

Open A4-Tacks opened this issue 5 months ago • 2 comments

Auto generate trait name from first method.

Input:

impl S$0 {
    fn foo() {}
}

Old output:

trait NewTrait {
    fn foo();
}

impl NewTrait for S {
    fn foo() {}
}

This PR output:

trait Foo {
    fn foo();
}

impl Foo for S {
    fn foo() {}
}

A4-Tacks avatar Jul 24 '25 07:07 A4-Tacks

Why specifically from the first method, or from methods at all? I'm not sure this is advantageous.

ChayimFriedman2 avatar Jul 24 '25 09:07 ChayimFriedman2

Having placeholder snippet group, incorrect name is irrelevant

A4-Tacks avatar Jul 24 '25 10:07 A4-Tacks