about summary refs log tree commit diff
diff options
context:
space:
mode:
authordswij <dharmasw@outlook.com>2025-08-14 11:06:08 +0000
committerGitHub <noreply@github.com>2025-08-14 11:06:08 +0000
commit3e86f05b89815ce2948745e64de560867bf8f0c0 (patch)
tree4c5406a6126b3ebe3b5f675389c6cb617e23acf9
parentca194053d1a12249ad0b638256e822ae6ca275de (diff)
parent7f23aba59556bc390b04b2f0748b4ff0ed1c05fb (diff)
downloadrust-3e86f05b89815ce2948745e64de560867bf8f0c0.tar.gz
rust-3e86f05b89815ce2948745e64de560867bf8f0c0.zip
`result_large_err`: get `DefId` from `AdtDef` instead of `expect`ing (#15467)
tiny simplification

changelog: none
-rw-r--r--clippy_lints/src/functions/result.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/clippy_lints/src/functions/result.rs b/clippy_lints/src/functions/result.rs
index bb98ae82611..1f2fce687ed 100644
--- a/clippy_lints/src/functions/result.rs
+++ b/clippy_lints/src/functions/result.rs
@@ -97,11 +97,7 @@ fn check_result_unit_err(cx: &LateContext<'_>, err_ty: Ty<'_>, fn_header_span: S
 
 fn check_result_large_err<'tcx>(cx: &LateContext<'tcx>, err_ty: Ty<'tcx>, hir_ty_span: Span, large_err_threshold: u64) {
     if let ty::Adt(adt, subst) = err_ty.kind()
-        && let Some(local_def_id) = err_ty
-            .ty_adt_def()
-            .expect("already checked this is adt")
-            .did()
-            .as_local()
+        && let Some(local_def_id) = adt.did().as_local()
         && let hir::Node::Item(item) = cx.tcx.hir_node_by_def_id(local_def_id)
         && let hir::ItemKind::Enum(_, _, ref def) = item.kind
     {