Skip to content

Commit

Permalink
Remove superfluous allocation in array serialization (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
caelunshun authored Jan 30, 2021
1 parent 0ea396f commit 36d27a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ macro_rules! array_serializer {

let mut seq = $serializer.serialize_tuple_struct(magic, length)?;
for _i in 0..length {
seq.serialize_field(iter.next().ok_or(SerError::custom(error))?.borrow())?;
seq.serialize_field(iter.next().ok_or_else(|| SerError::custom(error))?.borrow())?;
}

if iter.next().is_some() {
Expand Down

0 comments on commit 36d27a3

Please sign in to comment.