]> git.lizzy.rs Git - rust.git/commitdiff
Avoid mir in missing_errors_doc
authorCameron Steffen <cam.steffen94@gmail.com>
Fri, 5 Mar 2021 16:32:15 +0000 (10:32 -0600)
committerCameron Steffen <cam.steffen94@gmail.com>
Fri, 5 Mar 2021 16:36:20 +0000 (10:36 -0600)
clippy_lints/src/doc.rs

index 39a202f281cb7d2f8908cff1d8ac402e0d4c2c99..99c084af1b0d023dc58d8cba565462c66b6316bc 100644 (file)
@@ -325,9 +325,9 @@ fn lint_for_missing_headers<'tcx>(
             if_chain! {
                 if let Some(body_id) = body_id;
                 if let Some(future) = cx.tcx.lang_items().future_trait();
-                let def_id = cx.tcx.hir().body_owner_def_id(body_id);
-                let mir = cx.tcx.optimized_mir(def_id.to_def_id());
-                let ret_ty = mir.return_ty();
+                let typeck = cx.tcx.typeck_body(body_id);
+                let body = cx.tcx.hir().body(body_id);
+                let ret_ty = typeck.expr_ty(&body.value);
                 if implements_trait(cx, ret_ty, future, &[]);
                 if let ty::Opaque(_, subs) = ret_ty.kind();
                 if let Some(gen) = subs.types().next();