Skip to content

Commit

Permalink
Merge pull request #1230 from goffrie/patch-1
Browse files Browse the repository at this point in the history
Use Map::with_capacity in value::Serializer::serialize_map
  • Loading branch information
dtolnay authored Jan 19, 2025
2 parents 9802c08 + 513e5b2 commit eb9f3f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/value/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ impl serde::Serializer for Serializer {
})
}

fn serialize_map(self, _len: Option<usize>) -> Result<Self::SerializeMap> {
fn serialize_map(self, len: Option<usize>) -> Result<Self::SerializeMap> {
Ok(SerializeMap::Map {
map: Map::new(),
map: Map::with_capacity(len.unwrap_or(0)),
next_key: None,
})
}
Expand Down

0 comments on commit eb9f3f6

Please sign in to comment.