Skip to content

Commit

Permalink
Preserve existing allocations when cloning Punctuated
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 17, 2023
1 parent 3d05bb5 commit 2cb7f28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/punctuated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ where
last: self.last.clone(),
}
}

fn clone_from(&mut self, other: &Self) {
self.inner.clone_from(&other.inner);
self.last.clone_from(&other.last);
}
}

#[cfg(feature = "extra-traits")]
Expand Down

0 comments on commit 2cb7f28

Please sign in to comment.