Skip to content

Commit cb3e5af

Browse files
committed
don't repeat the ty::Adt check
is done already inside `is_type_diagnostic_item`
1 parent d0de0ec commit cb3e5af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clippy_lints/src/matches/try_err.rs

Lines changed: 3 additions & 3 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, option_arg_ty};
3+
use clippy_utils::ty::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;
@@ -88,8 +88,8 @@ fn find_return_type<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx ExprKind<'_>) -> O
8888

8989
/// Extracts the error type from Result<T, E>.
9090
fn result_error_type<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'tcx>> {
91-
if let ty::Adt(_, subst) = ty.kind()
92-
&& is_type_diagnostic_item(cx, ty, sym::Result)
91+
if let ty::Adt(def, subst) = ty.kind()
92+
&& cx.tcx.is_diagnostic_item(sym::Result, def.did())
9393
{
9494
Some(subst.type_at(1))
9595
} else {

0 commit comments

Comments
 (0)