We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dcf320a commit a7d3637Copy full SHA for a7d3637
src/libstd/option.rs
@@ -211,19 +211,13 @@ impl<T> Option<T> {
211
/// Return an iterator over the possibly contained value
212
#[inline]
213
pub fn iter<'r>(&'r self) -> Item<&'r T> {
214
- match *self {
215
- Some(ref x) => Item{opt: Some(x)},
216
- None => Item{opt: None}
217
- }
+ Item{opt: self.as_ref()}
218
}
219
220
/// Return a mutable iterator over the possibly contained value
221
222
pub fn mut_iter<'r>(&'r mut self) -> Item<&'r mut T> {
223
224
- Some(ref mut x) => Item{opt: Some(x)},
225
226
+ Item{opt: self.as_mut()}
227
228
229
/// Return a consuming iterator over the possibly contained value
0 commit comments