From c1f2da40ab63813066c0d573951bff2aab69a811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Tue, 14 Apr 2020 12:25:45 +0200 Subject: [PATCH] rustup https://github.com/rust-lang/rust/pull/70643 --- clippy_lints/src/len_zero.rs | 10 +++++----- clippy_lints/src/new_without_default.rs | 2 +- clippy_lints/src/unused_self.rs | 2 +- clippy_lints/src/use_self.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index a875e58775e7..5d94013cb65d 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -121,7 +121,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LenZero { fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item<'_>, trait_items: &[TraitItemRef]) { fn is_named_self(cx: &LateContext<'_, '_>, item: &TraitItemRef, name: &str) -> bool { item.ident.name.as_str() == name - && if let AssocItemKind::Method { has_self } = item.kind { + && if let AssocItemKind::Fn { has_self } = item.kind { has_self && { let did = cx.tcx.hir().local_def_id(item.id.hir_id); 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 .iter() .flat_map(|&i| cx.tcx.associated_items(i).in_definition_order()) .any(|i| { - i.kind == ty::AssocKind::Method - && i.method_has_self_argument + i.kind == ty::AssocKind::Fn + && i.fn_has_self_parameter && i.ident.name == sym!(is_empty) && cx.tcx.fn_sig(i.def_id).inputs().skip_binder().len() == 1 }); @@ -172,7 +172,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item<'_>, trait_i fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item<'_>, impl_items: &[ImplItemRef<'_>]) { fn is_named_self(cx: &LateContext<'_, '_>, item: &ImplItemRef<'_>, name: &str) -> bool { item.ident.name.as_str() == name - && if let AssocItemKind::Method { has_self } = item.kind { + && if let AssocItemKind::Fn { has_self } = item.kind { has_self && { let did = cx.tcx.hir().local_def_id(item.id.hir_id); cx.tcx.fn_sig(did).inputs().skip_binder().len() == 1 @@ -261,7 +261,7 @@ fn check_len( fn has_is_empty(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool { /// Gets an `AssocItem` and return true if it matches `is_empty(self)`. fn is_is_empty(cx: &LateContext<'_, '_>, item: &ty::AssocItem) -> bool { - if let ty::AssocKind::Method = item.kind { + if let ty::AssocKind::Fn = item.kind { if item.ident.name.as_str() == "is_empty" { let sig = cx.tcx.fn_sig(item.def_id); let ty = sig.skip_binder(); diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs index 09f4cccf7431..9d065005c99d 100644 --- a/clippy_lints/src/new_without_default.rs +++ b/clippy_lints/src/new_without_default.rs @@ -100,7 +100,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault { } = item.kind { for assoc_item in items { - if let hir::AssocItemKind::Method { has_self: false } = assoc_item.kind { + if let hir::AssocItemKind::Fn { has_self: false } = assoc_item.kind { let impl_item = cx.tcx.hir().impl_item(assoc_item.id); if in_external_macro(cx.sess(), impl_item.span) { return; diff --git a/clippy_lints/src/unused_self.rs b/clippy_lints/src/unused_self.rs index 102892ebda3b..4483059e9eca 100644 --- a/clippy_lints/src/unused_self.rs +++ b/clippy_lints/src/unused_self.rs @@ -50,7 +50,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedSelf { let assoc_item = cx.tcx.associated_item(def_id); if_chain! { if let ItemKind::Impl { of_trait: None, .. } = parent_item.kind; - if assoc_item.method_has_self_argument; + if assoc_item.fn_has_self_parameter; if let ImplItemKind::Fn(.., body_id) = &impl_item.kind; let body = cx.tcx.hir().body(*body_id); if !body.params.is_empty(); diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs index 412bebb9bc6e..f8e1aff33e77 100644 --- a/clippy_lints/src/use_self.rs +++ b/clippy_lints/src/use_self.rs @@ -119,7 +119,7 @@ fn check_trait_method_impl_decl<'a, 'tcx>( let trait_method = cx .tcx .associated_items(impl_trait_ref.def_id) - .find_by_name_and_kind(cx.tcx, impl_item.ident, ty::AssocKind::Method, impl_trait_ref.def_id) + .find_by_name_and_kind(cx.tcx, impl_item.ident, ty::AssocKind::Fn, impl_trait_ref.def_id) .expect("impl method matches a trait method"); let trait_method_sig = cx.tcx.fn_sig(trait_method.def_id);