Skip to content

Feature: Assist to convert match to let #17773

@kpreid

Description

@kpreid
struct Example {
    v: i32,
}

fn foo(e: Example) {
    match e {
        Example { v } => undefined(v),
    }
}

This match can be replaced with a let. It would be useful if rust-analyzer would offer to convert it. In this case, rustc does give an applicable suggestion, but that suggestion is only available when check has run and when the program is free of other errors, so it would be useful to have this refactor available even when the program does not compile, for use as an editing tool on the way to getting it to compile.

@rustbot label +A-assists

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