mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
This commit is contained in:
parent
33ec4e5220
commit
a4b99c6d68
1 changed files with 9 additions and 4 deletions
|
@ -302,10 +302,15 @@ fn has_is_empty(cx: &LateContext<'_, '_>, expr: &Expr) -> bool {
|
|||
|
||||
let ty = &walk_ptrs_ty(cx.tables.expr_ty(expr));
|
||||
match ty.sty {
|
||||
ty::Dynamic(ref tt, ..) => cx
|
||||
.tcx
|
||||
.associated_items(tt.principal().def_id())
|
||||
.any(|item| is_is_empty(cx, &item)),
|
||||
ty::Dynamic(ref tt, ..) => {
|
||||
if let Some(principal) = tt.principal() {
|
||||
cx.tcx
|
||||
.associated_items(principal.def_id())
|
||||
.any(|item| is_is_empty(cx, &item))
|
||||
} else {
|
||||
false
|
||||
}
|
||||
},
|
||||
ty::Projection(ref proj) => has_is_empty_impl(cx, proj.item_def_id),
|
||||
ty::Adt(id, _) => has_is_empty_impl(cx, id.did),
|
||||
ty::Array(..) | ty::Slice(..) | ty::Str => true,
|
||||
|
|
Loading…
Reference in a new issue