mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
Rustup to rust-lang/rust#69072
This commit is contained in:
parent
f5b4acccf7
commit
ce896ae96d
@ -147,7 +147,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item<'_>, trait_i
|
||||
|
||||
let is_empty_method_found = current_and_super_traits
|
||||
.iter()
|
||||
.flat_map(|&i| cx.tcx.associated_items(i))
|
||||
.flat_map(|&i| cx.tcx.associated_items(i).in_definition_order())
|
||||
.any(|i| {
|
||||
i.kind == ty::AssocKind::Method
|
||||
&& i.method_has_self_argument
|
||||
@ -276,10 +276,12 @@ fn has_is_empty(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
|
||||
|
||||
/// Checks the inherent impl's items for an `is_empty(self)` method.
|
||||
fn has_is_empty_impl(cx: &LateContext<'_, '_>, id: DefId) -> bool {
|
||||
cx.tcx
|
||||
.inherent_impls(id)
|
||||
.iter()
|
||||
.any(|imp| cx.tcx.associated_items(*imp).iter().any(|item| is_is_empty(cx, &item)))
|
||||
cx.tcx.inherent_impls(id).iter().any(|imp| {
|
||||
cx.tcx
|
||||
.associated_items(*imp)
|
||||
.in_definition_order()
|
||||
.any(|item| is_is_empty(cx, &item))
|
||||
})
|
||||
}
|
||||
|
||||
let ty = &walk_ptrs_ty(cx.tables.expr_ty(expr));
|
||||
@ -288,7 +290,7 @@ fn has_is_empty(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
|
||||
if let Some(principal) = tt.principal() {
|
||||
cx.tcx
|
||||
.associated_items(principal.def_id())
|
||||
.iter()
|
||||
.in_definition_order()
|
||||
.any(|item| is_is_empty(cx, &item))
|
||||
} else {
|
||||
false
|
||||
|
@ -125,13 +125,7 @@ fn check_trait_method_impl_decl<'a, 'tcx>(
|
||||
let trait_method = cx
|
||||
.tcx
|
||||
.associated_items(impl_trait_ref.def_id)
|
||||
.iter()
|
||||
.find(|assoc_item| {
|
||||
assoc_item.kind == ty::AssocKind::Method
|
||||
&& cx
|
||||
.tcx
|
||||
.hygienic_eq(impl_item.ident, assoc_item.ident, impl_trait_ref.def_id)
|
||||
})
|
||||
.find_by_name_and_kind(cx.tcx, impl_item.ident, ty::AssocKind::Method, impl_trait_ref.def_id)
|
||||
.expect("impl method matches a trait method");
|
||||
|
||||
let trait_method_sig = cx.tcx.fn_sig(trait_method.def_id);
|
||||
|
Loading…
Reference in New Issue
Block a user