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
This commit is contained in:
Mingun 2024-08-03 14:49:38 +05:00
parent 28a092261b
commit bc5af506bd

View File

@ -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<usize>) -> Result<Self::SerializeSeq, Self::Error> {