From 5e085e43104f6748a9717bb78de8b634712638b4 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Sun, 15 Jul 2018 02:04:23 +0200 Subject: [PATCH] Remove use of ty_to_def_id --- clippy_lints/src/len_zero.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index 33930ab58db..c1ec7a16296 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -258,11 +258,10 @@ fn has_is_empty(cx: &LateContext, expr: &Expr) -> bool { let ty = &walk_ptrs_ty(cx.tables.expr_ty(expr)); match ty.sty { - ty::TyDynamic(..) => cx.tcx - .associated_items(ty.ty_to_def_id().expect("trait impl not found")) + ty::TyDynamic(ref tt, ..) => cx.tcx + .associated_items(tt.principal().expect("trait impl not found").def_id()) .any(|item| is_is_empty(cx, &item)), - ty::TyProjection(_) => ty.ty_to_def_id() - .map_or(false, |id| has_is_empty_impl(cx, id)), + ty::TyProjection(ref proj) => has_is_empty_impl(cx, proj.item_def_id), ty::TyAdt(id, _) => has_is_empty_impl(cx, id.did), ty::TyArray(..) | ty::TySlice(..) | ty::TyStr => true, _ => false,