Skip to content

Commit 132307c

Browse files
committed
Rename as_chunks_mut_unchecked -> as_chunks_unchecked_mut
1 parent ae4b5a2 commit 132307c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

library/core/src/slice/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1038,22 +1038,22 @@ impl<T> [T] {
10381038
/// let slice: &mut [char] = &mut ['l', 'o', 'r', 'e', 'm', '!'];
10391039
/// let chunks: &mut [[char; 1]] =
10401040
/// // SAFETY: 1-element chunks never have remainder
1041-
/// unsafe { slice.as_chunks_mut_unchecked() };
1041+
/// unsafe { slice.as_chunks_unchecked_mut() };
10421042
/// chunks[0] = ['L'];
10431043
/// assert_eq!(chunks, &[['L'], ['o'], ['r'], ['e'], ['m'], ['!']]);
10441044
/// let chunks: &mut [[char; 3]] =
10451045
/// // SAFETY: The slice length (6) is a multiple of 3
1046-
/// unsafe { slice.as_chunks_mut_unchecked() };
1046+
/// unsafe { slice.as_chunks_unchecked_mut() };
10471047
/// chunks[1] = ['a', 'x', '?'];
10481048
/// assert_eq!(slice, &['L', 'o', 'r', 'a', 'x', '?']);
10491049
///
10501050
/// // These would be unsound:
1051-
/// // let chunks: &[[_; 5]] = slice.as_chunks_mut_unchecked() // The slice length is not a multiple of 5
1052-
/// // let chunks: &[[_; 0]] = slice.as_chunks_mut_unchecked() // Zero-length chunks are never allowed
1051+
/// // let chunks: &[[_; 5]] = slice.as_chunks_unchecked_mut() // The slice length is not a multiple of 5
1052+
/// // let chunks: &[[_; 0]] = slice.as_chunks_unchecked_mut() // Zero-length chunks are never allowed
10531053
/// ```
10541054
#[unstable(feature = "slice_as_chunks", issue = "74985")]
10551055
#[inline]
1056-
pub unsafe fn as_chunks_mut_unchecked<const N: usize>(&mut self) -> &mut [[T; N]] {
1056+
pub unsafe fn as_chunks_unchecked_mut<const N: usize>(&mut self) -> &mut [[T; N]] {
10571057
debug_assert_ne!(N, 0);
10581058
debug_assert_eq!(self.len() % N, 0);
10591059
let new_len =
@@ -1096,7 +1096,7 @@ impl<T> [T] {
10961096
let (multiple_of_n, remainder) = self.split_at_mut(len * N);
10971097
// SAFETY: We already panicked for zero, and ensured by construction
10981098
// that the length of the subslice is a multiple of N.
1099-
let array_slice = unsafe { multiple_of_n.as_chunks_mut_unchecked() };
1099+
let array_slice = unsafe { multiple_of_n.as_chunks_unchecked_mut() };
11001100
(array_slice, remainder)
11011101
}
11021102

@@ -1132,7 +1132,7 @@ impl<T> [T] {
11321132
let (remainder, multiple_of_n) = self.split_at_mut(self.len() - len * N);
11331133
// SAFETY: We already panicked for zero, and ensured by construction
11341134
// that the length of the subslice is a multiple of N.
1135-
let array_slice = unsafe { multiple_of_n.as_chunks_mut_unchecked() };
1135+
let array_slice = unsafe { multiple_of_n.as_chunks_unchecked_mut() };
11361136
(remainder, array_slice)
11371137
}
11381138

0 commit comments

Comments
 (0)