Fix suggestion unwrap_or_else

This commit is contained in:
Alexey Semenyuk 2024-08-24 15:43:00 +05:00
parent ecfc7d906f
commit f4fc3858bc
3 changed files with 402 additions and 203 deletions

View file

@ -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,
);