Skip to content

Commit b482246

Browse files
committed
chore: use same method as Vec for clone
1 parent 3918fbd commit b482246

File tree

1 file changed

+2
-4
lines changed
  • libs/@local/hashql/core/src/heap

1 file changed

+2
-4
lines changed

libs/@local/hashql/core/src/heap/clone.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,8 @@ impl<T: Clone, A: Allocator, B: Allocator> TryCloneIn<A> for Vec<T, B> {
9696

9797
#[inline]
9898
fn try_clone_in(&self, allocator: A) -> Result<Self::Cloned, AllocError> {
99-
let mut dst =
100-
Vec::try_with_capacity_in(self.capacity(), allocator).map_err(|_err| AllocError)?;
101-
dst.extend_from_slice(self);
102-
Ok(dst)
99+
let cloned = <[T]>::to_vec_in(self, allocator);
100+
Ok(cloned)
103101
}
104102

105103
#[inline]

0 commit comments

Comments
 (0)