Skip to content

Commit

Permalink
Rollup merge of #109093 - Dante-Broggi:patch-2, r=joshtriplett
Browse files Browse the repository at this point in the history
add `#[doc(alias="flatmap")]` to `Option::and_then`

I keep forgetting that rust calls this `and_then` and trying to search for `flatmap`. `and_then`'s docs even mention "Some languages call this operation flatmap", but it doesn't show up as a result in the search at `https://doc.rust-lang.org/std/?search=flatmap`
  • Loading branch information
matthiaskrgr authored Jun 4, 2023
2 parents 9eee230 + 7fb34c9 commit 7ee2505
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,7 @@ impl<T> Option<T> {
/// let item_2_0 = arr_2d.get(2).and_then(|row| row.get(0));
/// assert_eq!(item_2_0, None);
/// ```
#[doc(alias = "flatmap")]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn and_then<U, F>(self, f: F) -> Option<U>
Expand Down

0 comments on commit 7ee2505

Please sign in to comment.