Skip to content

Commit 380e679

Browse files
authored
Rollup merge of rust-lang#76543 - ssomers:btree_cleanup_4, r=Mark-Simulacrum
Document btree's unwrap_unchecked rust-lang#74693's second wind
2 parents b166fcd + 8af87b0 commit 380e679

File tree

1 file changed

+3
-0
lines changed
  • alloc/src/collections/btree

1 file changed

+3
-0
lines changed

alloc/src/collections/btree/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ trait Recover<Q: ?Sized> {
1313
fn replace(&mut self, key: Self::Key) -> Option<Self::Key>;
1414
}
1515

16+
/// Same purpose as `Option::unwrap` but doesn't always guarantee a panic
17+
/// if the option contains no value.
18+
/// SAFETY: the caller must ensure that the option contains a value.
1619
#[inline(always)]
1720
pub unsafe fn unwrap_unchecked<T>(val: Option<T>) -> T {
1821
val.unwrap_or_else(|| {

0 commit comments

Comments
 (0)