about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-02-14 16:04:40 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-02-22 18:05:28 +0000
commitf566867ace85044ef80f73cf9c214876a5aa4e77 (patch)
tree5dc0af56f2551366bfbfa190baba071d56398990
parentcaa216d2451e669a8efd1e2ef19b57fb010fde75 (diff)
downloadrust-f566867ace85044ef80f73cf9c214876a5aa4e77.tar.gz
rust-f566867ace85044ef80f73cf9c214876a5aa4e77.zip
Add `flatmap`/`flat_map` -> `and_then` suggestions
-rw-r--r--library/core/src/option.rs1
-rw-r--r--library/core/src/result.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index 0e5eb03239c..53c9ae498c0 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -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>,
diff --git a/library/core/src/result.rs b/library/core/src/result.rs
index 80f7fe75e82..6879ac03f70 100644
--- a/library/core/src/result.rs
+++ b/library/core/src/result.rs
@@ -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),