must_use on split_off

This commit is contained in:
Kornel 2020-03-20 14:40:35 +00:00
parent f4c675c476
commit 2f7d7c0333
1 changed files with 1 additions and 0 deletions

View File

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