get DefId from AdtDef instead of expecting
This commit is contained in:
parent
874f1c8dc0
commit
7f23aba595
1 changed files with 1 additions and 5 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue