Skip to content

Renaming a struct field should rename constructor arguments of the same name #10489

@jplatte

Description

@jplatte

When renaming a struct field, one often has to go clean up any constructors manually by also renaming the variable there. It would be nice if this was automated.

Example:

struct Struct {
    // renamed from struct_field
    field: String,
}

impl Struct {
    // this parameter should have been renamed too
    fn new(struct_field: String) -> Self {
        // so that struct init shorthand is used here
        Self { field: struct_field }
    }
}

Related: #6547

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-assistsC-featureCategory: feature requestS-actionableSomeone could pick this issue up and work on it right now

    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