Skip to content

[feat] better DX when function renamed #3008

@loynoir

Description

@loynoir

feat

better DX when function renamed

problem

When function renamed

  • serde attribute is not renamed

Would be nice to have attribute auto renamed for better DX.

Is it possible?

Are there any road blockers issue trackers?

current

current before renamed

#[derive(Deserialize)]
pub struct Reproduce {
    #[serde(default = "foo")]
    pub foo: String,
}

pub fn foo() -> String {
    "foo".into()
}

current after renamed, serde default attribute is not changed

#[derive(Deserialize)]
pub struct Reproduce {
    #[serde(default = "foo")]
    pub foo: String,
}

pub fn renamed() -> String {
    "foo".into()
}

feat

expect before renamed

#[derive(Deserialize)]
pub struct Reproduce {
    #[serde(default = foo)]
    pub foo: String,
}

pub fn foo() -> String {
    "foo".into()
}

expect after renamed, serde default attribute is changed

#[derive(Deserialize)]
pub struct Reproduce {
    #[serde(default = renamed)]
    pub foo: String,
}

pub fn renamed() -> String {
    "foo".into()
}

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