Add flatmap/flat_map -> and_then suggestions
This commit is contained in:
parent
caa216d245
commit
f566867ace
2 changed files with 2 additions and 0 deletions
|
|
@ -1403,6 +1403,7 @@ impl<T> Option<T> {
|
|||
#[doc(alias = "flatmap")]
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_confusables("flat_map", "flatmap")]
|
||||
pub fn and_then<U, F>(self, f: F) -> Option<U>
|
||||
where
|
||||
F: FnOnce(T) -> Option<U>,
|
||||
|
|
|
|||
|
|
@ -1315,6 +1315,7 @@ impl<T, E> Result<T, E> {
|
|||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_confusables("flat_map", "flatmap")]
|
||||
pub fn and_then<U, F: FnOnce(T) -> Result<U, E>>(self, op: F) -> Result<U, E> {
|
||||
match self {
|
||||
Ok(t) => op(t),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue