diff options
| author | Ada Alakbarova <ada.alakbarova@proton.me> | 2025-08-21 23:51:26 +0200 |
|---|---|---|
| committer | Ada Alakbarova <ada.alakbarova@proton.me> | 2025-08-22 15:03:15 +0200 |
| commit | d0de0ec4143cf7c486c02efea0d6f8879cada356 (patch) | |
| tree | 7be122d3a3a3ec3e2e5eadec2bc3e335a12346a9 | |
| parent | 79a95eee88fd17cea24a8ee9835baf3873b18fac (diff) | |
use `result_error_type`
| -rw-r--r-- | clippy_lints/src/matches/try_err.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/clippy_lints/src/matches/try_err.rs b/clippy_lints/src/matches/try_err.rs index c133ed08424..f6c319b753c 100644 --- a/clippy_lints/src/matches/try_err.rs +++ b/clippy_lints/src/matches/try_err.rs @@ -101,11 +101,9 @@ fn result_error_type<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'t fn poll_result_error_type<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<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::Result, ready_def.did()) { - Some(ready_subst.type_at(1)) + let ready_ty = subst.type_at(0); + result_error_type(cx, ready_ty) } else { None } @@ -117,10 +115,8 @@ fn poll_option_result_error_type<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> && cx.tcx.lang_items().get(LangItem::Poll) == Some(def.did()) && let ready_ty = 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()) { - Some(some_subst.type_at(1)) + result_error_type(cx, some_ty) } else { None } |
