Skip to content

Commit 54285db

Browse files
authored
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.
2 parents 937ca43 + 2f7d7c0 commit 54285db

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/liballoc/vec.rs

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

0 commit comments

Comments
 (0)