From aab0af69524de7743181f7970227a6daa22bfc16 Mon Sep 17 00:00:00 2001 From: aochagavia Date: Fri, 14 Mar 2014 16:56:59 +0100 Subject: [PATCH] Refactored mut_iter (libstd/option.rs) Using as_mut() instead of match --- src/libstd/option.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libstd/option.rs b/src/libstd/option.rs index 86f8c143a9e99..bfb0bf35016d0 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -220,10 +220,7 @@ impl Option { /// Return a mutable iterator over the possibly contained value #[inline] pub fn mut_iter<'r>(&'r mut self) -> Item<&'r mut T> { - match *self { - Some(ref mut x) => Item{opt: Some(x)}, - None => Item{opt: None} - } + Item{opt: self.as_mut()} } /// Return a consuming iterator over the possibly contained value