diff --git a/src/libstd/option.rs b/src/libstd/option.rs index 86f8c143a9e99..91be9145640e2 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -211,10 +211,7 @@ impl Option { /// Return an iterator over the possibly contained value #[inline] pub fn iter<'r>(&'r self) -> Item<&'r T> { - match *self { - Some(ref x) => Item{opt: Some(x)}, - None => Item{opt: None} - } + Item{opt: self.as_ref()} } /// Return a mutable iterator over the possibly contained value