diff options
| author | bors <bors@rust-lang.org> | 2013-09-19 09:55:59 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-19 09:55:59 -0700 |
| commit | 755f6229da1d436f4cb23fffea644ba13291b434 (patch) | |
| tree | 7bb62b2c7de33a72c9cc9f387c80a7a4f0daa47d /src/libstd | |
| parent | 068e04231ded7fccca349babb1ba58ab3d796f40 (diff) | |
| parent | 1a90f24bbdd4decec3df35d628fdb8825675190a (diff) | |
| download | rust-755f6229da1d436f4cb23fffea644ba13291b434.tar.gz rust-755f6229da1d436f4cb23fffea644ba13291b434.zip | |
auto merge of #9279 : erickt/rust/master, r=alexcrichton
`Some(5).or_{default,zero}` can be easily replaced with `Some(Some(5).unwrap_or_default())`.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/option.rs | 20 |
1 files changed, 1 insertions, 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<T: Default> Option<T> { None => Default::default() } } - - /// Returns self or `Some`-wrapped default value - #[inline] - pub fn or_default(self) -> Option<T> { - match self { - None => Some(Default::default()), - x => x, - } - } } impl<T> Default for Option<T> { @@ -483,7 +474,7 @@ impl<T> Default for Option<T> { fn default() -> Option<T> { None } } -impl<T:Zero> Option<T> { +impl<T: Zero> Option<T> { /// Returns the contained value or zero (for this type) #[inline] pub fn unwrap_or_zero(self) -> T { @@ -492,15 +483,6 @@ impl<T:Zero> Option<T> { None => Zero::zero() } } - - /// Returns self or `Some`-wrapped zero value - #[inline] - pub fn or_zero(self) -> Option<T> { - match self { - None => Some(Zero::zero()), - x => x - } - } } /// An iterator that yields either one or zero elements |
