Skip to content

Commit

Permalink
Use serialize_entry instead of serialize_key + serialize_value when s…
Browse files Browse the repository at this point in the history
…erialize flatten newtype enum variant

Serializers that reimplements serialize_entry will get benefits from that
  • Loading branch information
Mingun committed Aug 3, 2024
1 parent 28a0922 commit bc5af50
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions serde/src/private/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit bc5af50

Please sign in to comment.