envy icon indicating copy to clipboard operation
envy copied to clipboard

rename_all attribute does not work

Open AtsukiTak opened this issue 4 years ago • 1 comments

🐛 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

AtsukiTak avatar Jan 04 '21 08:01 AtsukiTak

maybe it's relevant to #42

AtsukiTak avatar Jan 04 '21 08:01 AtsukiTak