Attempt to address perf regressions with #[inline]
This commit is contained in:
parent
3024efff59
commit
61b1394ac7
1 changed files with 4 additions and 2 deletions
|
@ -331,18 +331,20 @@ impl<T: Ord, const N: usize> Ord for [T; N] {
|
|||
}
|
||||
|
||||
#[cfg(not(bootstrap))]
|
||||
#[stable(feature = "copy_clone_array_lib", since = "1.55.0")]
|
||||
#[stable(feature = "copy_clone_array_lib", since = "1.58.0")]
|
||||
impl<T: Copy, const N: usize> Copy for [T; N] {}
|
||||
|
||||
#[cfg(not(bootstrap))]
|
||||
#[stable(feature = "copy_clone_array_lib", since = "1.55.0")]
|
||||
#[stable(feature = "copy_clone_array_lib", since = "1.58.0")]
|
||||
impl<T: Clone, const N: usize> Clone for [T; N] {
|
||||
#[inline]
|
||||
fn clone(&self) -> Self {
|
||||
// SAFETY: we know for certain that this iterator will yield exactly `N`
|
||||
// items.
|
||||
unsafe { collect_into_array_unchecked(&mut self.iter().cloned()) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn clone_from(&mut self, other: &Self) {
|
||||
self.clone_from_slice(other);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue