|
1 | 1 | use super::{DocHeaders, MISSING_ERRORS_DOC, MISSING_PANICS_DOC, MISSING_SAFETY_DOC, UNNECESSARY_SAFETY_DOC};
|
2 | 2 | use clippy_utils::diagnostics::{span_lint, span_lint_and_note};
|
3 |
| -use clippy_utils::ty::{implements_trait, is_type_diagnostic_item}; |
| 3 | +use clippy_utils::ty::{implements_trait_with_env, is_type_diagnostic_item}; |
4 | 4 | use clippy_utils::{is_doc_hidden, return_ty};
|
5 | 5 | use rustc_hir::{BodyId, FnSig, OwnerId, Safety};
|
6 | 6 | use rustc_lint::LateContext;
|
@@ -70,7 +70,14 @@ pub fn check(
|
70 | 70 | && let typeck = cx.tcx.typeck_body(body_id)
|
71 | 71 | && let body = cx.tcx.hir().body(body_id)
|
72 | 72 | && let ret_ty = typeck.expr_ty(body.value)
|
73 |
| - && implements_trait(cx, ret_ty, future, &[]) |
| 73 | + && implements_trait_with_env( |
| 74 | + cx.tcx, |
| 75 | + ty::TypingEnv::non_body_analysis(cx.tcx, owner_id.def_id), |
| 76 | + ret_ty, |
| 77 | + future, |
| 78 | + Some(owner_id.def_id.to_def_id()), |
| 79 | + &[], |
| 80 | + ) |
74 | 81 | && let ty::Coroutine(_, subs) = ret_ty.kind()
|
75 | 82 | && is_type_diagnostic_item(cx, subs.as_coroutine().return_ty(), sym::Result)
|
76 | 83 | {
|
|
0 commit comments