]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/methods/option_as_ref_deref.rs
Merge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyup
[rust.git] / src / tools / clippy / clippy_lints / src / methods / option_as_ref_deref.rs
index 81c67b4ca6a59d0816908e88e600eeff66e13e38..6fb92d1c663cf6de9ee7a7421656186fad5d7908 100644 (file)
@@ -53,7 +53,7 @@ pub(super) fn check<'tcx>(
             }),
         hir::ExprKind::Closure(&hir::Closure { body, .. }) => {
             let closure_body = cx.tcx.hir().body(body);
-            let closure_expr = peel_blocks(&closure_body.value);
+            let closure_expr = peel_blocks(closure_body.value);
 
             match &closure_expr.kind {
                 hir::ExprKind::MethodCall(_, receiver, [], _) => {
@@ -98,13 +98,12 @@ pub(super) fn check<'tcx>(
             format!(".as_ref().map({})", snippet(cx, map_arg.span, ".."))
         };
         let method_hint = if is_mut { "as_deref_mut" } else { "as_deref" };
-        let hint = format!("{}.{}()", snippet(cx, as_ref_recv.span, ".."), method_hint);
-        let suggestion = format!("try using {} instead", method_hint);
+        let hint = format!("{}.{method_hint}()", snippet(cx, as_ref_recv.span, ".."));
+        let suggestion = format!("try using {method_hint} instead");
 
         let msg = format!(
-            "called `{0}` on an Option value. This can be done more directly \
-            by calling `{1}` instead",
-            current_method, hint
+            "called `{current_method}` on an Option value. This can be done more directly \
+            by calling `{hint}` instead"
         );
         span_lint_and_sugg(
             cx,