Skip to content

Commit 85e8b64

Browse files
committed
Auto merge of #5463 - matthiaskrgr:rustup_42, r=phansch
rustup rust-lang/rust#70643 changelog: none
2 parents 74e9256 + c1f2da4 commit 85e8b64

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

clippy_lints/src/len_zero.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LenZero {
121121
fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item<'_>, trait_items: &[TraitItemRef]) {
122122
fn is_named_self(cx: &LateContext<'_, '_>, item: &TraitItemRef, name: &str) -> bool {
123123
item.ident.name.as_str() == name
124-
&& if let AssocItemKind::Method { has_self } = item.kind {
124+
&& if let AssocItemKind::Fn { has_self } = item.kind {
125125
has_self && {
126126
let did = cx.tcx.hir().local_def_id(item.id.hir_id);
127127
cx.tcx.fn_sig(did).inputs().skip_binder().len() == 1
@@ -149,8 +149,8 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item<'_>, trait_i
149149
.iter()
150150
.flat_map(|&i| cx.tcx.associated_items(i).in_definition_order())
151151
.any(|i| {
152-
i.kind == ty::AssocKind::Method
153-
&& i.method_has_self_argument
152+
i.kind == ty::AssocKind::Fn
153+
&& i.fn_has_self_parameter
154154
&& i.ident.name == sym!(is_empty)
155155
&& cx.tcx.fn_sig(i.def_id).inputs().skip_binder().len() == 1
156156
});
@@ -172,7 +172,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item<'_>, trait_i
172172
fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item<'_>, impl_items: &[ImplItemRef<'_>]) {
173173
fn is_named_self(cx: &LateContext<'_, '_>, item: &ImplItemRef<'_>, name: &str) -> bool {
174174
item.ident.name.as_str() == name
175-
&& if let AssocItemKind::Method { has_self } = item.kind {
175+
&& if let AssocItemKind::Fn { has_self } = item.kind {
176176
has_self && {
177177
let did = cx.tcx.hir().local_def_id(item.id.hir_id);
178178
cx.tcx.fn_sig(did).inputs().skip_binder().len() == 1
@@ -261,7 +261,7 @@ fn check_len(
261261
fn has_is_empty(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
262262
/// Gets an `AssocItem` and return true if it matches `is_empty(self)`.
263263
fn is_is_empty(cx: &LateContext<'_, '_>, item: &ty::AssocItem) -> bool {
264-
if let ty::AssocKind::Method = item.kind {
264+
if let ty::AssocKind::Fn = item.kind {
265265
if item.ident.name.as_str() == "is_empty" {
266266
let sig = cx.tcx.fn_sig(item.def_id);
267267
let ty = sig.skip_binder();

clippy_lints/src/new_without_default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
100100
} = item.kind
101101
{
102102
for assoc_item in items {
103-
if let hir::AssocItemKind::Method { has_self: false } = assoc_item.kind {
103+
if let hir::AssocItemKind::Fn { has_self: false } = assoc_item.kind {
104104
let impl_item = cx.tcx.hir().impl_item(assoc_item.id);
105105
if in_external_macro(cx.sess(), impl_item.span) {
106106
return;

clippy_lints/src/unused_self.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedSelf {
5050
let assoc_item = cx.tcx.associated_item(def_id);
5151
if_chain! {
5252
if let ItemKind::Impl { of_trait: None, .. } = parent_item.kind;
53-
if assoc_item.method_has_self_argument;
53+
if assoc_item.fn_has_self_parameter;
5454
if let ImplItemKind::Fn(.., body_id) = &impl_item.kind;
5555
let body = cx.tcx.hir().body(*body_id);
5656
if !body.params.is_empty();

clippy_lints/src/use_self.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ fn check_trait_method_impl_decl<'a, 'tcx>(
119119
let trait_method = cx
120120
.tcx
121121
.associated_items(impl_trait_ref.def_id)
122-
.find_by_name_and_kind(cx.tcx, impl_item.ident, ty::AssocKind::Method, impl_trait_ref.def_id)
122+
.find_by_name_and_kind(cx.tcx, impl_item.ident, ty::AssocKind::Fn, impl_trait_ref.def_id)
123123
.expect("impl method matches a trait method");
124124

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

0 commit comments

Comments
 (0)