From 5ab843fbc3924fc7706f8adf281da7aff3dced31 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Fri, 13 Sep 2013 16:38:36 -0700 Subject: [PATCH] std: Remove Option.or_{default,zero} These can be replaced with `Some(option.or_default())`. --- src/libstd/option.rs | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/libstd/option.rs b/src/libstd/option.rs index 9b6d0a77cd8..42878f6effb 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -467,15 +467,6 @@ impl Option { None => Default::default() } } - - /// Returns self or `Some`-wrapped default value - #[inline] - pub fn or_default(self) -> Option { - match self { - None => Some(Default::default()), - x => x, - } - } } impl Default for Option { @@ -483,7 +474,7 @@ impl Default for Option { fn default() -> Option { None } } -impl Option { +impl Option { /// Returns the contained value or zero (for this type) #[inline] pub fn unwrap_or_zero(self) -> T { @@ -492,15 +483,6 @@ impl Option { None => Zero::zero() } } - - /// Returns self or `Some`-wrapped zero value - #[inline] - pub fn or_zero(self) -> Option { - match self { - None => Some(Zero::zero()), - x => x - } - } } /// An iterator that yields either one or zero elements