Simplify access of packed struct fields in derived Serialize impls
This commit is contained in:
parent
c2114491ca
commit
1fe39043ee
@ -1246,14 +1246,14 @@ fn get_member(params: &Parameters, field: &Field, member: &Member) -> TokenStrea
|
|||||||
match (params.is_remote, field.attrs.getter()) {
|
match (params.is_remote, field.attrs.getter()) {
|
||||||
(false, None) => {
|
(false, None) => {
|
||||||
if params.is_packed {
|
if params.is_packed {
|
||||||
quote!(&{let copy = #self_var.#member; copy })
|
quote!(&{#self_var.#member})
|
||||||
} else {
|
} else {
|
||||||
quote!(&#self_var.#member)
|
quote!(&#self_var.#member)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(true, None) => {
|
(true, None) => {
|
||||||
let inner = if params.is_packed {
|
let inner = if params.is_packed {
|
||||||
quote!(&{let copy = #self_var.#member; copy })
|
quote!(&{#self_var.#member})
|
||||||
} else {
|
} else {
|
||||||
quote!(&#self_var.#member)
|
quote!(&#self_var.#member)
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user