Skip to content

Commit 5d6272a

Browse files
committed
Adjust wording
1 parent 23d74f2 commit 5d6272a

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
@@ -3188,10 +3188,11 @@ impl<T> [T] {
31883188
left
31893189
}
31903190

3191-
/// Removes and returns the portion of the slice specified by `range`.
3191+
/// Returns the subslice corresponding to the given range,
3192+
/// and modifies the slice to no longer include this subslice.
31923193
///
3193-
/// If the provided `range` starts or ends outside of the slice,
3194-
/// `None` is returned and the slice is not modified.
3194+
/// Returns `None` and does not modify the slice if the given
3195+
/// range is out of bounds.
31953196
///
31963197
/// # Examples
31973198
///
@@ -3250,10 +3251,11 @@ impl<T> [T] {
32503251
}
32513252
}
32523253

3253-
/// Removes and returns the portion of the mutable slice specified by `range`.
3254+
/// Returns the mutable subslice corresponding to the given range,
3255+
/// and modifies the slice to no longer include this subslice.
32543256
///
3255-
/// If the provided `range` starts or ends outside of the slice,
3256-
/// `None` is returned and the slice is not modified.
3257+
/// Returns `None` and does not modify the slice if the given
3258+
/// range is out of bounds.
32573259
///
32583260
/// # Examples
32593261
///
@@ -3315,9 +3317,8 @@ impl<T> [T] {
33153317
}
33163318
}
33173319

3318-
/// Takes the first element out of the slice.
3319-
///
3320-
/// Returns a reference pointing to the first element of the old slice.
3320+
/// Returns a reference to the first element of the slice,
3321+
/// and modifies the slice to no longer include this element.
33213322
///
33223323
/// Returns `None` if the slice is empty.
33233324
///
@@ -3338,9 +3339,8 @@ impl<T> [T] {
33383339
self.take(..=0).map(|res| &res[0])
33393340
}
33403341

3341-
/// Takes the first element out of the mutable slice.
3342-
///
3343-
/// Returns a mutable reference pointing to the first element of the old slice.
3342+
/// Returns a mutable reference to the first element of the slice,
3343+
/// and modifies the slice to no longer include this element.
33443344
///
33453345
/// Returns `None` if the slice is empty.
33463346
///
@@ -3362,9 +3362,8 @@ impl<T> [T] {
33623362
self.take_mut(..=0).map(|res| &mut res[0])
33633363
}
33643364

3365-
/// Takes the last element out of the slice.
3366-
///
3367-
/// Returns a reference pointing to the last element of the old slice.
3365+
/// Returns a reference to the last element of the slice,
3366+
/// and modifies the slice to no longer include this element.
33683367
///
33693368
/// Returns `None` if the slice is empty.
33703369
///
@@ -3385,9 +3384,8 @@ impl<T> [T] {
33853384
self.take((self.len() - 1)..).map(|res| &res[0])
33863385
}
33873386

3388-
/// Takes the last element out of the mutable slice.
3389-
///
3390-
/// Returns a mutable reference pointing to the last element of the old slice.
3387+
/// Returns a mutable reference to the last element of the slice,
3388+
/// and modifies the slice to no longer include this element.
33913389
///
33923390
/// Returns `None` if the slice is empty.
33933391
///

0 commit comments

Comments
 (0)