]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/manual_async_fn.rs
Auto merge of #98109 - nikomatsakis:issue-98095, r=jackh726
[rust.git] / src / tools / clippy / clippy_lints / src / manual_async_fn.rs
index babc6fab3c0fb03d5c617c001001bdb80df97fe2..d7d8a59215280d8b6ca08ea0d750f599eff20eb4 100644 (file)
@@ -86,7 +86,7 @@ fn check_fn(
                                 diag.span_suggestion(
                                     block.span,
                                     "move the body of the async block to the enclosing function",
-                                    body_snip.to_string(),
+                                    body_snip,
                                     Applicability::MachineApplicable
                                 );
                             }
@@ -177,8 +177,8 @@ fn desugared_async_block<'tcx>(cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>)
         if let Some(block_expr) = block.expr;
         if let Some(args) = match_function_call(cx, block_expr, &FUTURE_FROM_GENERATOR);
         if args.len() == 1;
-        if let Expr{kind: ExprKind::Closure(_, _, body_id, ..), ..} = args[0];
-        let closure_body = cx.tcx.hir().body(body_id);
+        if let Expr{kind: ExprKind::Closure { body, .. }, ..} = args[0];
+        let closure_body = cx.tcx.hir().body(body);
         if closure_body.generator_kind == Some(GeneratorKind::Async(AsyncGeneratorKind::Block));
         then {
             return Some(closure_body);