We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1e9f076 commit 5e085e4Copy full SHA for 5e085e4
clippy_lints/src/len_zero.rs
@@ -258,11 +258,10 @@ fn has_is_empty(cx: &LateContext, expr: &Expr) -> bool {
258
259
let ty = &walk_ptrs_ty(cx.tables.expr_ty(expr));
260
match ty.sty {
261
- ty::TyDynamic(..) => cx.tcx
262
- .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())
263
.any(|item| is_is_empty(cx, &item)),
264
- ty::TyProjection(_) => ty.ty_to_def_id()
265
- .map_or(false, |id| has_is_empty_impl(cx, id)),
+ ty::TyProjection(ref proj) => has_is_empty_impl(cx, proj.item_def_id),
266
ty::TyAdt(id, _) => has_is_empty_impl(cx, id.did),
267
ty::TyArray(..) | ty::TySlice(..) | ty::TyStr => true,
268
_ => false,
0 commit comments