about summary refs log tree commit diff
path: root/clippy_lints/src/methods/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'clippy_lints/src/methods/mod.rs')
-rw-r--r--clippy_lints/src/methods/mod.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs
index 433f513b1a8..ebd8af93dd0 100644
--- a/clippy_lints/src/methods/mod.rs
+++ b/clippy_lints/src/methods/mod.rs
@@ -1737,10 +1737,9 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
             return;
         }
         let name = impl_item.ident.name.as_str();
-        let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id);
+        let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id());
         let item = cx.tcx.hir().expect_item(parent);
-        let def_id = cx.tcx.hir().local_def_id(item.hir_id);
-        let self_ty = cx.tcx.type_of(def_id);
+        let self_ty = cx.tcx.type_of(item.def_id);
 
         // if this impl block implements a trait, lint in trait definition instead
         if let hir::ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }) = item.kind {
@@ -1751,8 +1750,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
             if let hir::ImplItemKind::Fn(ref sig, id) = impl_item.kind;
             if let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.hir().body(id)).next();
 
-            let method_def_id = cx.tcx.hir().local_def_id(impl_item.hir_id);
-            let method_sig = cx.tcx.fn_sig(method_def_id);
+            let method_sig = cx.tcx.fn_sig(impl_item.def_id);
             let method_sig = cx.tcx.erase_late_bound_regions(method_sig);
 
             let first_arg_ty = &method_sig.inputs().iter().next();
@@ -1761,7 +1759,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
             if let Some(first_arg_ty) = first_arg_ty;
 
             then {
-                if cx.access_levels.is_exported(impl_item.hir_id) {
+                if cx.access_levels.is_exported(impl_item.hir_id()) {
                     // check missing trait implementations
                     for method_config in &TRAIT_METHODS {
                         if name == method_config.method_name &&
@@ -1803,7 +1801,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
         }
 
         if let hir::ImplItemKind::Fn(_, _) = impl_item.kind {
-            let ret_ty = return_ty(cx, impl_item.hir_id);
+            let ret_ty = return_ty(cx, impl_item.hir_id());
 
             // walk the return type and check for Self (this does not check associated types)
             if contains_ty(ret_ty, self_ty) {
@@ -1844,7 +1842,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
             if let Some(first_arg_ty) = sig.decl.inputs.iter().next();
             let first_arg_span = first_arg_ty.span;
             let first_arg_ty = hir_ty_to_ty(cx.tcx, first_arg_ty);
-            let self_ty = TraitRef::identity(cx.tcx, item.hir_id.owner.to_def_id()).self_ty();
+            let self_ty = TraitRef::identity(cx.tcx, item.def_id.to_def_id()).self_ty();
 
             then {
                 lint_wrong_self_convention(cx, &item.ident.name.as_str(), false, self_ty, first_arg_ty, first_arg_span);
@@ -1854,8 +1852,8 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
         if_chain! {
             if item.ident.name == sym::new;
             if let TraitItemKind::Fn(_, _) = item.kind;
-            let ret_ty = return_ty(cx, item.hir_id);
-            let self_ty = TraitRef::identity(cx.tcx, item.hir_id.owner.to_def_id()).self_ty();
+            let ret_ty = return_ty(cx, item.hir_id());
+            let self_ty = TraitRef::identity(cx.tcx, item.def_id.to_def_id()).self_ty();
             if !contains_ty(ret_ty, self_ty);
 
             then {