@@ -3078,10 +3078,11 @@ impl<T> [T] {
3078
3078
left
3079
3079
}
3080
3080
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.
3082
3083
///
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 .
3085
3086
///
3086
3087
/// # Examples
3087
3088
///
@@ -3140,10 +3141,11 @@ impl<T> [T] {
3140
3141
}
3141
3142
}
3142
3143
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.
3144
3146
///
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 .
3147
3149
///
3148
3150
/// # Examples
3149
3151
///
@@ -3205,9 +3207,8 @@ impl<T> [T] {
3205
3207
}
3206
3208
}
3207
3209
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.
3211
3212
///
3212
3213
/// Returns `None` if the slice is empty.
3213
3214
///
@@ -3228,9 +3229,8 @@ impl<T> [T] {
3228
3229
self . take ( ..=0 ) . map ( |res| & res[ 0 ] )
3229
3230
}
3230
3231
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.
3234
3234
///
3235
3235
/// Returns `None` if the slice is empty.
3236
3236
///
@@ -3252,9 +3252,8 @@ impl<T> [T] {
3252
3252
self . take_mut ( ..=0 ) . map ( |res| & mut res[ 0 ] )
3253
3253
}
3254
3254
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.
3258
3257
///
3259
3258
/// Returns `None` if the slice is empty.
3260
3259
///
@@ -3275,9 +3274,8 @@ impl<T> [T] {
3275
3274
self . take ( ( self . len ( ) - 1 ) ..) . map ( |res| & res[ 0 ] )
3276
3275
}
3277
3276
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.
3281
3279
///
3282
3280
/// Returns `None` if the slice is empty.
3283
3281
///
0 commit comments