diff options
| author | Ada Alakbarova <ada.alakbarova@proton.me> | 2025-08-21 23:52:20 +0200 |
|---|---|---|
| committer | Ada Alakbarova <ada.alakbarova@proton.me> | 2025-08-22 15:03:16 +0200 |
| commit | cb3e5af74658fefa55b513a55d2789c84ef4bfd5 (patch) | |
| tree | 5a3ec3f57366433a72869b5802d576065eca8f2b | |
| parent | d0de0ec4143cf7c486c02efea0d6f8879cada356 (diff) | |
| download | rust-cb3e5af74658fefa55b513a55d2789c84ef4bfd5.tar.gz rust-cb3e5af74658fefa55b513a55d2789c84ef4bfd5.zip | |
don't repeat the `ty::Adt` check
is done already inside `is_type_diagnostic_item`
| -rw-r--r-- | clippy_lints/src/matches/try_err.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clippy_lints/src/matches/try_err.rs b/clippy_lints/src/matches/try_err.rs index f6c319b753c..d595f21aa62 100644 --- a/clippy_lints/src/matches/try_err.rs +++ b/clippy_lints/src/matches/try_err.rs @@ -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, option_arg_ty}; +use clippy_utils::ty::option_arg_ty; use clippy_utils::{get_parent_expr, is_res_lang_ctor, path_res}; use rustc_errors::Applicability; use rustc_hir::LangItem::ResultErr; @@ -88,8 +88,8 @@ fn find_return_type<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx ExprKind<'_>) -> O /// Extracts the error type from Result<T, E>. fn result_error_type<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'tcx>> { - if let ty::Adt(_, subst) = ty.kind() - && is_type_diagnostic_item(cx, ty, sym::Result) + if let ty::Adt(def, subst) = ty.kind() + && cx.tcx.is_diagnostic_item(sym::Result, def.did()) { Some(subst.type_at(1)) } else { |
