Skip to content

rename_all attribute does not work #53

Open
@AtsukiTak

Description

@AtsukiTak

🐛 Bug description

When I use #[serde(rename_all = "camelCase")] attribute, envy seems to unable to find target variable.
I tried another case such as SCREAMING_SNAKE_CASE but it also fails.

#[derive(Deserialize, PartialEq, Debug)]
#[serde(rename_all = "camelCase")]
struct Bar {
    hoge_hoge: String
}

#[test]
fn deserialize_with_rename_all() {
    let data = vec![(String::from("hogeHoge"), String::from("yey"))];
    
    // it returns "Err(MissingValue("hogeHoge"))"
    from_iter::<_, Bar>(data);
}

🤔 Expected Behavior

envy should find corresponding environmental variable.

👟 Steps to reproduce

#[derive(Deserialize, PartialEq, Debug)]
#[serde(rename_all = "camelCase")]
struct Bar {
    hoge_hoge: String
}

#[test]
fn deserialize_with_rename_all() {
    let data = vec![(String::from("hogeHoge"), String::from("yey"))];
    
    // it returns "Err(MissingValue("hogeHoge"))"
    from_iter::<_, Bar>(data);
}

🌍 Your environment

macOS 10.15.6
rustc 1.47.0
envy version: 0.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions