Rollup merge of #76543 - ssomers:btree_cleanup_4, r=Mark-Simulacrum
Document btree's unwrap_unchecked #74693's second wind
This commit is contained in:
commit
8bf03c3f62
@ -13,6 +13,9 @@ trait Recover<Q: ?Sized> {
|
||||
fn replace(&mut self, key: Self::Key) -> Option<Self::Key>;
|
||||
}
|
||||
|
||||
/// Same purpose as `Option::unwrap` but doesn't always guarantee a panic
|
||||
/// if the option contains no value.
|
||||
/// SAFETY: the caller must ensure that the option contains a value.
|
||||
#[inline(always)]
|
||||
pub unsafe fn unwrap_unchecked<T>(val: Option<T>) -> T {
|
||||
val.unwrap_or_else(|| {
|
||||
|
Loading…
Reference in New Issue
Block a user