Skip to content

Commit dd4627a

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 6e7d47d + f42dac0 commit dd4627a

File tree

1 file changed

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

1 file changed

+3
-0
lines changed

library/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)