Skip to content

assist: rename to match field name #21780

@pickx

Description

@pickx

$ represents the cursor

fn new() -> MyStruct {
    // ...
    MyStruct {
        foo,
        bar: some_var_name$,
        baz,
    }
}

here it should be suggested to rename some_var_name to bar, to end up with

MyStruct {
    foo,
    bar,
    baz,
}

this is especially useful if the name of the field was previously some_var_name, and then was later renamed to bar so the local variable name has desynced from the field name

(the name of the assist can be bikeshedded, I can't think of a good one right now)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-featureCategory: feature request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions