From 2cb7f280149c11e6bb921c8326aa8c3ec84b0979 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 16 Jul 2023 18:49:42 -0700 Subject: [PATCH] Preserve existing allocations when cloning Punctuated --- src/punctuated.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/punctuated.rs b/src/punctuated.rs index a4278081c4..3ea8a1d4ee 100644 --- a/src/punctuated.rs +++ b/src/punctuated.rs @@ -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")]