Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/libstd/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<T> Option<T> {
}
}

/// Convert from `Option<T>` to `&[T]` (without copying)
/// Convert from `Option<T>` to `&mut [T]` (without copying)
#[inline]
pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] {
match *self {
Expand Down Expand Up @@ -211,19 +211,13 @@ impl<T> Option<T> {
/// 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
#[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
Expand Down