update docs, test

This commit is contained in:
Jeremy Smart 2025-06-11 22:57:57 -04:00
parent 6469eb1c28
commit 9d19cbe29b
No known key found for this signature in database
GPG Key ID: 5AD8086D5DF29A8F
2 changed files with 3 additions and 5 deletions

View File

@ -735,13 +735,9 @@ impl<T> Vec<T> {
unsafe { Self::from_parts_in(ptr, length, capacity, Global) }
}
/// Returns a mutable reference to the greatest item in the binary heap, or
/// Returns a mutable reference to the last item in the vector, or
/// `None` if it is empty.
///
/// Note: If the `PeekMut` value is leaked, some heap elements might get
/// leaked along with it, but the remaining elements will remain a valid
/// heap.
///
/// # Examples
///
/// Basic usage:

View File

@ -2708,6 +2708,8 @@ fn test_peek_mut() {
assert_eq!(*p, 2);
*p = 0;
assert_eq!(*p, 0);
p.pop();
assert_eq!(vec.len(), 1);
} else {
unreachable!()
}