@@ -3188,10 +3188,11 @@ impl<T> [T] {
3188
3188
left
3189
3189
}
3190
3190
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.
3192
3193
///
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 .
3195
3196
///
3196
3197
/// # Examples
3197
3198
///
@@ -3250,10 +3251,11 @@ impl<T> [T] {
3250
3251
}
3251
3252
}
3252
3253
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.
3254
3256
///
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 .
3257
3259
///
3258
3260
/// # Examples
3259
3261
///
@@ -3315,9 +3317,8 @@ impl<T> [T] {
3315
3317
}
3316
3318
}
3317
3319
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.
3321
3322
///
3322
3323
/// Returns `None` if the slice is empty.
3323
3324
///
@@ -3338,9 +3339,8 @@ impl<T> [T] {
3338
3339
self . take ( ..=0 ) . map ( |res| & res[ 0 ] )
3339
3340
}
3340
3341
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.
3344
3344
///
3345
3345
/// Returns `None` if the slice is empty.
3346
3346
///
@@ -3362,9 +3362,8 @@ impl<T> [T] {
3362
3362
self . take_mut ( ..=0 ) . map ( |res| & mut res[ 0 ] )
3363
3363
}
3364
3364
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.
3368
3367
///
3369
3368
/// Returns `None` if the slice is empty.
3370
3369
///
@@ -3385,9 +3384,8 @@ impl<T> [T] {
3385
3384
self . take ( ( self . len ( ) - 1 ) ..) . map ( |res| & res[ 0 ] )
3386
3385
}
3387
3386
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.
3391
3389
///
3392
3390
/// Returns `None` if the slice is empty.
3393
3391
///
0 commit comments