Attempt to address perf regressions with #[inline]
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user