Merge pull request #171 from oli-obk/fix_skip_empty_field_ser
$value_expr starting with a & took address of resulting bool
This commit is contained in:
commit
612e384b03
@ -592,9 +592,9 @@ fn serialize_struct_visitor<I>(
|
|||||||
let key_expr = field.serializer_key_expr(cx);
|
let key_expr = field.serializer_key_expr(cx);
|
||||||
|
|
||||||
let stmt = if field.skip_serializing_field_if_empty() {
|
let stmt = if field.skip_serializing_field_if_empty() {
|
||||||
quote_stmt!(cx, if $value_expr.is_empty() { continue; })
|
quote_stmt!(cx, if ($value_expr).is_empty() { continue; })
|
||||||
} else if field.skip_serializing_field_if_none() {
|
} else if field.skip_serializing_field_if_none() {
|
||||||
quote_stmt!(cx, if $value_expr.is_none() { continue; })
|
quote_stmt!(cx, if ($value_expr).is_none() { continue; })
|
||||||
} else {
|
} else {
|
||||||
quote_stmt!(cx, {})
|
quote_stmt!(cx, {})
|
||||||
};
|
};
|
||||||
@ -636,9 +636,9 @@ fn serialize_struct_visitor<I>(
|
|||||||
if field.skip_serializing_field() {
|
if field.skip_serializing_field() {
|
||||||
quote_expr!(cx, 0)
|
quote_expr!(cx, 0)
|
||||||
} else if field.skip_serializing_field_if_empty() {
|
} else if field.skip_serializing_field_if_empty() {
|
||||||
quote_expr!(cx, if $value_expr.is_empty() { 0 } else { 1 })
|
quote_expr!(cx, if ($value_expr).is_empty() { 0 } else { 1 })
|
||||||
} else if field.skip_serializing_field_if_none() {
|
} else if field.skip_serializing_field_if_none() {
|
||||||
quote_expr!(cx, if $value_expr.is_none() { 0 } else { 1 })
|
quote_expr!(cx, if ($value_expr).is_none() { 0 } else { 1 })
|
||||||
} else {
|
} else {
|
||||||
quote_expr!(cx, 1)
|
quote_expr!(cx, 1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user