about summary refs log tree commit diff
path: root/clippy_lints/src/methods/map_flatten.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-30 08:32:54 +0000
committerbors <bors@rust-lang.org>2022-06-30 08:32:54 +0000
commit0cb0f7636851f9fcc57085cf80197a2ef6db098f (patch)
treee614515446be6457d225800d863c6d34f3d51908 /clippy_lints/src/methods/map_flatten.rs
parentff3964af1b497f5621f9c1e362cef24aeab4018a (diff)
parent9de1f9f45a85c452ea0371080687e0251f1395c1 (diff)
Auto merge of #9069 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
Diffstat (limited to 'clippy_lints/src/methods/map_flatten.rs')
-rw-r--r--clippy_lints/src/methods/map_flatten.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/clippy_lints/src/methods/map_flatten.rs b/clippy_lints/src/methods/map_flatten.rs
index f447940ea3b..13853dec99d 100644
--- a/clippy_lints/src/methods/map_flatten.rs
+++ b/clippy_lints/src/methods/map_flatten.rs
@@ -1,4 +1,4 @@
-use clippy_utils::diagnostics::span_lint_and_sugg_for_edges;
+use clippy_utils::diagnostics::span_lint_and_sugg;
 use clippy_utils::is_trait_method;
 use clippy_utils::source::snippet_with_applicability;
 use clippy_utils::ty::is_type_diagnostic_item;
@@ -14,17 +14,17 @@ use super::MAP_FLATTEN;
 pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, map_arg: &Expr<'_>, map_span: Span) {
     if let Some((caller_ty_name, method_to_use)) = try_get_caller_ty_name_and_method_name(cx, expr, recv, map_arg) {
         let mut applicability = Applicability::MachineApplicable;
-        let help_msgs = [
-            &format!("try replacing `map` with `{}`", method_to_use),
-            "and remove the `.flatten()`",
-        ];
+
         let closure_snippet = snippet_with_applicability(cx, map_arg.span, "..", &mut applicability);
-        span_lint_and_sugg_for_edges(
+        span_lint_and_sugg(
             cx,
             MAP_FLATTEN,
             expr.span.with_lo(map_span.lo()),
             &format!("called `map(..).flatten()` on `{}`", caller_ty_name),
-            &help_msgs,
+            &format!(
+                "try replacing `map` with `{}` and remove the `.flatten()`",
+                method_to_use
+            ),
             format!("{}({})", method_to_use, closure_snippet),
             applicability,
         );