From f566867ace85044ef80f73cf9c214876a5aa4e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 14 Feb 2024 16:04:40 +0000 Subject: [PATCH] Add `flatmap`/`flat_map` -> `and_then` suggestions --- library/core/src/option.rs | 1 + library/core/src/result.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 0e5eb03239ce..53c9ae498c08 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1403,6 +1403,7 @@ impl Option { #[doc(alias = "flatmap")] #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("flat_map", "flatmap")] pub fn and_then(self, f: F) -> Option where F: FnOnce(T) -> Option, diff --git a/library/core/src/result.rs b/library/core/src/result.rs index 80f7fe75e823..6879ac03f70b 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1315,6 +1315,7 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("flat_map", "flatmap")] pub fn and_then Result>(self, op: F) -> Result { match self { Ok(t) => op(t),