Skip to content

Commit

Permalink
Use Map::with_capacity in value::Serializer::serialize_map
Browse files Browse the repository at this point in the history
  • Loading branch information
goffrie authored Jan 18, 2025
1 parent 9802c08 commit 513e5b2
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 513e5b2

Please sign in to comment.