From 24c1b739bf5162112d0dcaae4fa66775cfb159e5 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 30 May 2019 19:12:31 +0200 Subject: [PATCH] Implement Termination for Option --- src/libstd/process.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 6e4c6e4c366e4..99e2becedcbad 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1625,6 +1625,16 @@ impl Termination for Result<(), E> { } } +#[unstable(feature = "termination_trait_lib", issue = "43301")] +impl Termination for Option { + fn report(self) -> i32 { + match self { + Some(v) => v.report(), + None => 1, + } + } +} + #[unstable(feature = "termination_trait_lib", issue = "43301")] impl Termination for ! { fn report(self) -> i32 { self }