Skip to content

Commit 7f23aba

Browse files
committed
get DefId from AdtDef instead of expecting
1 parent 874f1c8 commit 7f23aba

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)