You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
411 B
19 lines
411 B
|
6 years ago
|
/// This is copied from parking_lot
|
||
|
|
///
|
||
|
|
/// Copyright 2016 Amanieu d'Antras
|
||
|
|
|
||
|
|
// Option::unchecked_unwrap
|
||
|
|
pub trait UncheckedOptionExt<T> {
|
||
|
|
unsafe fn unchecked_unwrap(self) -> T;
|
||
|
|
}
|
||
|
|
|
||
|
|
impl<T> UncheckedOptionExt<T> for Option<T> {
|
||
|
|
#[inline]
|
||
|
|
unsafe fn unchecked_unwrap(self) -> T {
|
||
|
|
match self {
|
||
|
|
Some(x) => x,
|
||
|
|
None => core::hint::unreachable_unchecked(),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|