Merge commit '0cb0f76368' into clippyup
This commit is contained in:
parent
ee37029afa
commit
09f5df5087
243 changed files with 9046 additions and 3487 deletions
|
|
@ -14,14 +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 closure_snippet = snippet_with_applicability(cx, map_arg.span, "..", &mut applicability);
|
||||
span_lint_and_sugg(
|
||||
cx,
|
||||
MAP_FLATTEN,
|
||||
expr.span.with_lo(map_span.lo()),
|
||||
&format!("called `map(..).flatten()` on `{}`", caller_ty_name),
|
||||
&format!("try replacing `map` with `{}` and remove the `.flatten()`", method_to_use),
|
||||
&format!(
|
||||
"try replacing `map` with `{}` and remove the `.flatten()`",
|
||||
method_to_use
|
||||
),
|
||||
format!("{}({})", method_to_use, closure_snippet),
|
||||
applicability,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue