Skip to content

"introduce match" action #528

Closed
Closed
@killercup

Description

@killercup

Similar to "introduce variable", an "introduce match" action would replace the x under cursor here

fn maybe() -> Option<i32> { Some(42) }

fn foo() {
    let x = maybe();
    x<|>
}

with this:

    match x {
        _ => (),
    }

Assuming knowledge of the type of x, we could later on add special cases, e.g. for booleans (use if) or enums with two variants (use if let).

This is similar to #525 but maybe a bit more user-discoverable ;) Feel free to close this issue if you feel like #525 is a better approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions