Skip to content

Commit

Permalink
try out more permissive skip_serializing_if guards
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtbuilds committed Jan 1, 2024
1 parent 936c743 commit 5c7f71f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libninja/src/rust/lower_mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ impl FieldExt for HirField {
decorators.push(quote! {
#[serde(skip_serializing_if = "Option::is_none")]
});
} else if self.ty.is_iterable() {
decorators.push(quote! {
#[serde(skip_serializing_if = "Vec::is_empty")]
});
} else if matches!(self.ty, Ty::Any) {
decorators.push(quote! {
#[serde(skip_serializing_if = "serde_json::Value::is_null")]
});
}
if self.ty.inner_model().is_some() && config.ormlite {
decorators.push(quote! {
Expand Down

0 comments on commit 5c7f71f

Please sign in to comment.