Skip to content

Commit f42dac0

Browse files
committed
Document btree's unwrap_unchecked
1 parent d92155b commit f42dac0

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

+3
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)