Skip to content

Commit 9d19cbe

Browse files
committed
update docs, test
1 parent 6469eb1 commit 9d19cbe

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

library/alloc/src/vec/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -735,13 +735,9 @@ impl<T> Vec<T> {
735735
unsafe { Self::from_parts_in(ptr, length, capacity, Global) }
736736
}
737737

738-
/// Returns a mutable reference to the greatest item in the binary heap, or
738+
/// Returns a mutable reference to the last item in the vector, or
739739
/// `None` if it is empty.
740740
///
741-
/// Note: If the `PeekMut` value is leaked, some heap elements might get
742-
/// leaked along with it, but the remaining elements will remain a valid
743-
/// heap.
744-
///
745741
/// # Examples
746742
///
747743
/// Basic usage:

library/alloctests/tests/vec.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,8 @@ fn test_peek_mut() {
27082708
assert_eq!(*p, 2);
27092709
*p = 0;
27102710
assert_eq!(*p, 0);
2711+
p.pop();
2712+
assert_eq!(vec.len(), 1);
27112713
} else {
27122714
unreachable!()
27132715
}

0 commit comments

Comments
 (0)