Skip to content

Commit 79a95ee

Browse files
committed
use option_arg_ty
1 parent 8779679 commit 79a95ee

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

clippy_lints/src/matches/try_err.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
22
use clippy_utils::source::snippet_with_applicability;
3-
use clippy_utils::ty::is_type_diagnostic_item;
3+
use clippy_utils::ty::{is_type_diagnostic_item, option_arg_ty};
44
use clippy_utils::{get_parent_expr, is_res_lang_ctor, path_res};
55
use rustc_errors::Applicability;
66
use rustc_hir::LangItem::ResultErr;
@@ -116,9 +116,7 @@ fn poll_option_result_error_type<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) ->
116116
if let ty::Adt(def, subst) = ty.kind()
117117
&& cx.tcx.lang_items().get(LangItem::Poll) == Some(def.did())
118118
&& let ready_ty = subst.type_at(0)
119-
&& let ty::Adt(ready_def, ready_subst) = ready_ty.kind()
120-
&& cx.tcx.is_diagnostic_item(sym::Option, ready_def.did())
121-
&& let some_ty = ready_subst.type_at(0)
119+
&& let Some(some_ty) = option_arg_ty(cx, ready_ty)
122120
&& let ty::Adt(some_def, some_subst) = some_ty.kind()
123121
&& cx.tcx.is_diagnostic_item(sym::Result, some_def.did())
124122
{

0 commit comments

Comments
 (0)