Skip to content

fill-match-arms should prefer to use Self when inside of an impl of an enum #19927

Open
@jhgg

Description

@jhgg

When in this context:

enum Foo {
   Bar, 
   Baz
}

impl Foo {
    fn qux(&self) {
        match self {
             $0_ => { }
        }
    }
}

The fill match arm assist should prefer Self over Foo when inside of impl Foo { }

impl Foo {
    fn qux(&self) {
        match self {
            Self::Bar => $0,
            Self::Baz => $1
        }
    }
}

Arguably this could be a configuration option, as some code-bases may not prefer this style.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions