Skip to content

Commit 3e86f05

Browse files
authored
result_large_err: get DefId from AdtDef instead of expecting (#15467)
tiny simplification changelog: none
2 parents ca19405 + 7f23aba commit 3e86f05

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

clippy_lints/src/functions/result.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,7 @@ fn check_result_unit_err(cx: &LateContext<'_>, err_ty: Ty<'_>, fn_header_span: S
9797

9898
fn check_result_large_err<'tcx>(cx: &LateContext<'tcx>, err_ty: Ty<'tcx>, hir_ty_span: Span, large_err_threshold: u64) {
9999
if let ty::Adt(adt, subst) = err_ty.kind()
100-
&& let Some(local_def_id) = err_ty
101-
.ty_adt_def()
102-
.expect("already checked this is adt")
103-
.did()
104-
.as_local()
100+
&& let Some(local_def_id) = adt.did().as_local()
105101
&& let hir::Node::Item(item) = cx.tcx.hir_node_by_def_id(local_def_id)
106102
&& let hir::ItemKind::Enum(_, _, ref def) = item.kind
107103
{

0 commit comments

Comments
 (0)