From f61d452814d6c7bf32d139e747d18c21592d702a Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 12 Aug 2024 13:00:04 -0700 Subject: [PATCH] Touch up PR 2795 --- serde_derive/src/de.rs | 3 ++- serde_derive/src/ser.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs index be1666e7..996e97e8 100644 --- a/serde_derive/src/de.rs +++ b/serde_derive/src/de.rs @@ -3027,7 +3027,8 @@ fn effective_style(variant: &Variant) -> Style { } } -/// True if there are fields that is not skipped and has a `#[serde(flatten)]` attribute. +/// True if there is any field with a `#[serde(flatten)]` attribute, other than +/// fields which are skipped. fn has_flatten(fields: &[Field]) -> bool { fields .iter() diff --git a/serde_derive/src/ser.rs b/serde_derive/src/ser.rs index 4f5e000d..35f8ca4b 100644 --- a/serde_derive/src/ser.rs +++ b/serde_derive/src/ser.rs @@ -294,7 +294,7 @@ fn serialize_struct(params: &Parameters, fields: &[Field], cattrs: &attr::Contai "too many fields in {}: {}, maximum supported count is {}", cattrs.name().serialize_name(), fields.len(), - u32::MAX + u32::MAX, ); let has_non_skipped_flatten = fields