Skip to content

Commit

Permalink
Rollup merge of #70194 - kornelski:must_split, r=joshtriplett
Browse files Browse the repository at this point in the history
#[must_use] on split_off()

I've noticed this function used for truncation in the wild. `must_use` will clear that up.
  • Loading branch information
Centril authored Mar 21, 2020
2 parents 6790c43 + 2f7d7c0 commit 74c27b4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 74c27b4

Please sign in to comment.