use option_arg_ty
This commit is contained in:
parent
877967959a
commit
79a95eee88
1 changed files with 2 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use clippy_utils::ty::is_type_diagnostic_item;
|
||||
use clippy_utils::ty::{is_type_diagnostic_item, option_arg_ty};
|
||||
use clippy_utils::{get_parent_expr, is_res_lang_ctor, path_res};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::LangItem::ResultErr;
|
||||
|
|
@ -116,9 +116,7 @@ fn poll_option_result_error_type<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) ->
|
|||
if let ty::Adt(def, subst) = ty.kind()
|
||||
&& cx.tcx.lang_items().get(LangItem::Poll) == Some(def.did())
|
||||
&& let ready_ty = subst.type_at(0)
|
||||
&& let ty::Adt(ready_def, ready_subst) = ready_ty.kind()
|
||||
&& cx.tcx.is_diagnostic_item(sym::Option, ready_def.did())
|
||||
&& let some_ty = ready_subst.type_at(0)
|
||||
&& let Some(some_ty) = option_arg_ty(cx, ready_ty)
|
||||
&& let ty::Adt(some_def, some_subst) = some_ty.kind()
|
||||
&& cx.tcx.is_diagnostic_item(sym::Result, some_def.did())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue