mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
Remove use of ty_to_def_id
This commit is contained in:
parent
1e9f076254
commit
5e085e4310
1 changed files with 3 additions and 4 deletions
|
@ -258,11 +258,10 @@ fn has_is_empty(cx: &LateContext, expr: &Expr) -> bool {
|
||||||
|
|
||||||
let ty = &walk_ptrs_ty(cx.tables.expr_ty(expr));
|
let ty = &walk_ptrs_ty(cx.tables.expr_ty(expr));
|
||||||
match ty.sty {
|
match ty.sty {
|
||||||
ty::TyDynamic(..) => cx.tcx
|
ty::TyDynamic(ref tt, ..) => cx.tcx
|
||||||
.associated_items(ty.ty_to_def_id().expect("trait impl not found"))
|
.associated_items(tt.principal().expect("trait impl not found").def_id())
|
||||||
.any(|item| is_is_empty(cx, &item)),
|
.any(|item| is_is_empty(cx, &item)),
|
||||||
ty::TyProjection(_) => ty.ty_to_def_id()
|
ty::TyProjection(ref proj) => has_is_empty_impl(cx, proj.item_def_id),
|
||||||
.map_or(false, |id| has_is_empty_impl(cx, id)),
|
|
||||||
ty::TyAdt(id, _) => has_is_empty_impl(cx, id.did),
|
ty::TyAdt(id, _) => has_is_empty_impl(cx, id.did),
|
||||||
ty::TyArray(..) | ty::TySlice(..) | ty::TyStr => true,
|
ty::TyArray(..) | ty::TySlice(..) | ty::TyStr => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
|
|
Loading…
Reference in a new issue