Skip to content

Commit 0d7ae7b

Browse files
committed
Auto merge of #5211 - krishna-veerareddy:rustup-69072, r=flip1995
Rustup to rust-lang/rust#69072 changelog: none
2 parents f5b4acc + ce896ae commit 0d7ae7b

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

clippy_lints/src/len_zero.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item<'_>, trait_i
147147

148148
let is_empty_method_found = current_and_super_traits
149149
.iter()
150-
.flat_map(|&i| cx.tcx.associated_items(i))
150+
.flat_map(|&i| cx.tcx.associated_items(i).in_definition_order())
151151
.any(|i| {
152152
i.kind == ty::AssocKind::Method
153153
&& i.method_has_self_argument
@@ -276,10 +276,12 @@ fn has_is_empty(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
276276

277277
/// Checks the inherent impl's items for an `is_empty(self)` method.
278278
fn has_is_empty_impl(cx: &LateContext<'_, '_>, id: DefId) -> bool {
279-
cx.tcx
280-
.inherent_impls(id)
281-
.iter()
282-
.any(|imp| cx.tcx.associated_items(*imp).iter().any(|item| is_is_empty(cx, &item)))
279+
cx.tcx.inherent_impls(id).iter().any(|imp| {
280+
cx.tcx
281+
.associated_items(*imp)
282+
.in_definition_order()
283+
.any(|item| is_is_empty(cx, &item))
284+
})
283285
}
284286

285287
let ty = &walk_ptrs_ty(cx.tables.expr_ty(expr));
@@ -288,7 +290,7 @@ fn has_is_empty(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
288290
if let Some(principal) = tt.principal() {
289291
cx.tcx
290292
.associated_items(principal.def_id())
291-
.iter()
293+
.in_definition_order()
292294
.any(|item| is_is_empty(cx, &item))
293295
} else {
294296
false

clippy_lints/src/use_self.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,7 @@ fn check_trait_method_impl_decl<'a, 'tcx>(
125125
let trait_method = cx
126126
.tcx
127127
.associated_items(impl_trait_ref.def_id)
128-
.iter()
129-
.find(|assoc_item| {
130-
assoc_item.kind == ty::AssocKind::Method
131-
&& cx
132-
.tcx
133-
.hygienic_eq(impl_item.ident, assoc_item.ident, impl_trait_ref.def_id)
134-
})
128+
.find_by_name_and_kind(cx.tcx, impl_item.ident, ty::AssocKind::Method, impl_trait_ref.def_id)
135129
.expect("impl method matches a trait method");
136130

137131
let trait_method_sig = cx.tcx.fn_sig(trait_method.def_id);

0 commit comments

Comments
 (0)