We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7647849 + ea8da6e commit 9e89ffcCopy full SHA for 9e89ffc
src/libstd/option.rs
@@ -311,10 +311,10 @@ impl<T> Option<T> {
311
/// Fails if the value equals `None`.
312
#[inline]
313
pub fn take_unwrap(&mut self) -> T {
314
- if self.is_none() {
315
- fail!("called `Option::take_unwrap()` on a `None` value")
+ match self.take() {
+ Some(x) => x,
316
+ None => fail!("called `Option::take_unwrap()` on a `None` value")
317
}
- self.take().unwrap()
318
319
320
/// Gets an immutable reference to the value inside an option.
0 commit comments