Skip to content

Commit

Permalink
Use FromIterator to impl Array::concat (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri authored Jan 11, 2024
1 parent 7c37040 commit b9eca70
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,7 @@ where
U: Add<N>,
Sum<U, N>: ArraySize,
{
let mut result = MaybeUninit::uninit();
let result_ptr = result.as_mut_ptr() as *mut Self;

unsafe {
ptr::write(result_ptr, self);
ptr::write(result_ptr.add(1).cast(), other);
result.assume_init()
}
Array::from_iter(self.into_iter().chain(other.into_iter()))
}

/// Splits `self` at index `N` in two arrays.
Expand Down

0 comments on commit b9eca70

Please sign in to comment.