fix deserialize_struct passing the original field names instead of the renamed ones
This commit is contained in:
parent
110d36fa14
commit
abe305dbfe
@ -717,6 +717,7 @@ fn deserialize_struct_visitor(
|
|||||||
let field_exprs = fields.iter()
|
let field_exprs = fields.iter()
|
||||||
.map(|field| field.attrs.name().deserialize_name())
|
.map(|field| field.attrs.name().deserialize_name())
|
||||||
.collect();
|
.collect();
|
||||||
|
let field_names = field_exprs.clone();
|
||||||
|
|
||||||
let field_visitor = deserialize_field_visitor(
|
let field_visitor = deserialize_field_visitor(
|
||||||
field_exprs,
|
field_exprs,
|
||||||
@ -732,10 +733,6 @@ fn deserialize_struct_visitor(
|
|||||||
item_attrs,
|
item_attrs,
|
||||||
);
|
);
|
||||||
|
|
||||||
let field_names = fields.iter().map(|field| {
|
|
||||||
field.ident.clone().expect("struct contains unnamed field").to_string()
|
|
||||||
});
|
|
||||||
|
|
||||||
let fields_stmt = quote! {
|
let fields_stmt = quote! {
|
||||||
const FIELDS: &'static [&'static str] = &[ #(#field_names),* ];
|
const FIELDS: &'static [&'static str] = &[ #(#field_names),* ];
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user