Skip to content

Commit

Permalink
Auto merge of #13299 - alex-semenyuk:unwrap_or_else_suggestion, r=Ale…
Browse files Browse the repository at this point in the history
…xendoo

Fix suggestion unnecessary_lazy_eval

As mentioned at #13293 improve suggestion via span_suggestion_verbose

changelog: none
  • Loading branch information
bors committed Aug 24, 2024
2 parents ecfc7d9 + f4fc385 commit 301f2c4
Show file tree
Hide file tree
Showing 3 changed files with 402 additions and 203 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/methods/unnecessary_lazy_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ pub(super) fn check<'tcx>(
// but prefer to avoid changing the signature of the function itself.
if let hir::ExprKind::MethodCall(.., span) = expr.kind {
span_lint_and_then(cx, UNNECESSARY_LAZY_EVALUATIONS, expr.span, msg, |diag| {
diag.span_suggestion(
diag.span_suggestion_verbose(
span,
format!("use `{simplify_using}(..)` instead"),
format!("use `{simplify_using}` instead"),
format!("{simplify_using}({})", snippet(cx, body_expr.span, "..")),
applicability,
);
Expand Down
Loading

0 comments on commit 301f2c4

Please sign in to comment.