Skip to content

Commit e375c8d

Browse files
committed
Adjust wording
1 parent 3394849 commit e375c8d

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

library/core/src/slice/mod.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3078,10 +3078,11 @@ impl<T> [T] {
30783078
left
30793079
}
30803080

3081-
/// Removes and returns the portion of the slice specified by `range`.
3081+
/// Returns the subslice corresponding to the given range,
3082+
/// and modifies the slice to no longer include this subslice.
30823083
///
3083-
/// If the provided `range` starts or ends outside of the slice,
3084-
/// `None` is returned and the slice is not modified.
3084+
/// Returns `None` and does not modify the slice if the given
3085+
/// range is out of bounds.
30853086
///
30863087
/// # Examples
30873088
///
@@ -3140,10 +3141,11 @@ impl<T> [T] {
31403141
}
31413142
}
31423143

3143-
/// Removes and returns the portion of the mutable slice specified by `range`.
3144+
/// Returns the mutable subslice corresponding to the given range,
3145+
/// and modifies the slice to no longer include this subslice.
31443146
///
3145-
/// If the provided `range` starts or ends outside of the slice,
3146-
/// `None` is returned and the slice is not modified.
3147+
/// Returns `None` and does not modify the slice if the given
3148+
/// range is out of bounds.
31473149
///
31483150
/// # Examples
31493151
///
@@ -3205,9 +3207,8 @@ impl<T> [T] {
32053207
}
32063208
}
32073209

3208-
/// Takes the first element out of the slice.
3209-
///
3210-
/// Returns a reference pointing to the first element of the old slice.
3210+
/// Returns a reference to the first element of the slice,
3211+
/// and modifies the slice to no longer include this element.
32113212
///
32123213
/// Returns `None` if the slice is empty.
32133214
///
@@ -3228,9 +3229,8 @@ impl<T> [T] {
32283229
self.take(..=0).map(|res| &res[0])
32293230
}
32303231

3231-
/// Takes the first element out of the mutable slice.
3232-
///
3233-
/// Returns a mutable reference pointing to the first element of the old slice.
3232+
/// Returns a mutable reference to the first element of the slice,
3233+
/// and modifies the slice to no longer include this element.
32343234
///
32353235
/// Returns `None` if the slice is empty.
32363236
///
@@ -3252,9 +3252,8 @@ impl<T> [T] {
32523252
self.take_mut(..=0).map(|res| &mut res[0])
32533253
}
32543254

3255-
/// Takes the last element out of the slice.
3256-
///
3257-
/// Returns a reference pointing to the last element of the old slice.
3255+
/// Returns a reference to the last element of the slice,
3256+
/// and modifies the slice to no longer include this element.
32583257
///
32593258
/// Returns `None` if the slice is empty.
32603259
///
@@ -3275,9 +3274,8 @@ impl<T> [T] {
32753274
self.take((self.len() - 1)..).map(|res| &res[0])
32763275
}
32773276

3278-
/// Takes the last element out of the mutable slice.
3279-
///
3280-
/// Returns a mutable reference pointing to the last element of the old slice.
3277+
/// Returns a mutable reference to the last element of the slice,
3278+
/// and modifies the slice to no longer include this element.
32813279
///
32823280
/// Returns `None` if the slice is empty.
32833281
///

0 commit comments

Comments
 (0)