From bc5af506bd068aa0d9b201832fab7c64652b9b13 Mon Sep 17 00:00:00 2001 From: Mingun Date: Sat, 3 Aug 2024 14:49:38 +0500 Subject: [PATCH] Use serialize_entry instead of serialize_key + serialize_value when serialize flatten newtype enum variant Serializers that reimplements serialize_entry will get benefits from that --- serde/src/private/ser.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/serde/src/private/ser.rs b/serde/src/private/ser.rs index 40cc6cbdb..9570629e9 100644 --- a/serde/src/private/ser.rs +++ b/serde/src/private/ser.rs @@ -1125,8 +1125,7 @@ where where T: ?Sized + Serialize, { - tri!(self.0.serialize_key(variant)); - self.0.serialize_value(value) + self.0.serialize_entry(variant, value) } fn serialize_seq(self, _: Option) -> Result {