Skip to content

simplify receivers for some array method calls #143378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions library/core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ impl<T, const N: usize> [T; N] {
)]
#[inline]
pub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T]) {
(&self[..]).split_first_chunk::<M>().unwrap()
self.split_first_chunk::<M>().unwrap()
}

/// Divides one mutable array reference into two at an index.
Expand Down Expand Up @@ -740,7 +740,7 @@ impl<T, const N: usize> [T; N] {
)]
#[inline]
pub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T]) {
(&mut self[..]).split_first_chunk_mut::<M>().unwrap()
self.split_first_chunk_mut::<M>().unwrap()
}

/// Divides one array reference into two at an index from the end.
Expand Down Expand Up @@ -785,7 +785,7 @@ impl<T, const N: usize> [T; N] {
)]
#[inline]
pub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M]) {
(&self[..]).split_last_chunk::<M>().unwrap()
self.split_last_chunk::<M>().unwrap()
}

/// Divides one mutable array reference into two at an index from the end.
Expand Down Expand Up @@ -818,7 +818,7 @@ impl<T, const N: usize> [T; N] {
)]
#[inline]
pub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M]) {
(&mut self[..]).split_last_chunk_mut::<M>().unwrap()
self.split_last_chunk_mut::<M>().unwrap()
}
}

Expand Down
Loading