Skip to content

Let "sort variants alphabetically" assist apply to match statements #20766

@Shnatsel

Description

@Shnatsel

I have an enum with an increasingly large number of variants that I'd like to sort alphabetically so that they don't get entirely out of hand.

Rust-analyzer already supports doing this for the enum declaration. However, I also have multiple match statements that operate on that enum, and I'd like to sort them in the same order as enum variants.

I can do it with a shell script in simple cases but anything even slightly more complex requires parsing Rust code, so I'd really prefer for rust-analyzer to handle it.

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