Skip to content

Commit

Permalink
Merge pull request #1487 from dtolnay/clonefrom
Browse files Browse the repository at this point in the history
Preserve existing allocations when cloning Punctuated
  • Loading branch information
dtolnay authored Jul 17, 2023
2 parents 3d05bb5 + 2cb7f28 commit 517f0e9
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 517f0e9

Please sign in to comment.