Rollup merge of #70194 - kornelski:must_split, r=joshtriplett

#[must_use] on split_off()

I've noticed this function used for truncation in the wild. `must_use` will clear that up.
This commit is contained in:
Mazdak Farrokhzad 2020-03-21 05:33:36 +01:00 committed by GitHub
commit 54285db640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -1377,6 +1377,7 @@ impl<T> Vec<T> {
/// assert_eq!(vec2, [2, 3]);
/// ```
#[inline]
#[must_use = "use `.truncate()` if you don't need the other half"]
#[stable(feature = "split_off", since = "1.4.0")]
pub fn split_off(&mut self, at: usize) -> Self {
assert!(at <= self.len(), "`at` out of bounds");