Skip to content

Commit

Permalink
hybrid-array: use Clone bound for TryFrom<&[T; N]> (#1019)
Browse files Browse the repository at this point in the history
Applicable to more use cases
  • Loading branch information
tarcieri authored Dec 31, 2023
1 parent 3e97167 commit 52e20ca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hybrid-array/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ where
where
Self: Clone,
{
Self::ref_from_slice(slice).clone()
slice.try_into().expect("slice length mismatch")
}

/// Concatenates `self` with `other`.
Expand Down Expand Up @@ -484,14 +484,14 @@ where

impl<'a, T, U> TryFrom<&'a [T]> for Array<T, U>
where
Self: Copy,
Self: Clone,
U: ArraySize,
{
type Error = TryFromSliceError;

#[inline]
fn try_from(slice: &'a [T]) -> Result<Array<T, U>, TryFromSliceError> {
<&'a Self>::try_from(slice).map(|ret| *ret)
<&'a Self>::try_from(slice).map(Clone::clone)
}
}

Expand Down

0 comments on commit 52e20ca

Please sign in to comment.