Skip to content

Commit

Permalink
Auto merge of #43416 - tshepang:extra-layer, r=alexcrichton
Browse files Browse the repository at this point in the history
doc: provide an actual equivalent to filter_map
  • Loading branch information
bors committed Jul 23, 2017
2 parents 3cf2c04 + fc90064 commit 6270257
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,16 +637,15 @@ pub trait Iterator {
/// let a = ["1", "2", "lol"];
///
/// let mut iter = a.iter()
/// .map(|s| s.parse().ok())
/// .filter(|s| s.is_some());
/// .map(|s| s.parse())
/// .filter(|s| s.is_ok())
/// .map(|s| s.unwrap());
///
/// assert_eq!(iter.next(), Some(Some(1)));
/// assert_eq!(iter.next(), Some(Some(2)));
/// assert_eq!(iter.next(), Some(1));
/// assert_eq!(iter.next(), Some(2));
/// assert_eq!(iter.next(), None);
/// ```
///
/// There's an extra layer of [`Some`] in there.
///
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Some`]: ../../std/option/enum.Option.html#variant.Some
/// [`None`]: ../../std/option/enum.Option.html#variant.None
Expand Down

0 comments on commit 6270257

Please sign in to comment.