diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs
index 01ced205af48..697486c1af09 100644
--- a/clippy_lints/src/functions.rs
+++ b/clippy_lints/src/functions.rs
@@ -486,7 +486,7 @@ fn is_mutable_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, tys: &mut FxHash
     if let hir::PatKind::Wild = pat.kind {
         return false; // ignore `_` patterns
     }
-    let def_id = pat.hir_id.owner_def_id();
+    let def_id = pat.hir_id.owner.to_def_id();
     if cx.tcx.has_typeck_tables(def_id) {
         is_mutable_ty(cx, &cx.tcx.typeck_tables_of(def_id).pat_ty(pat), pat.span, tys)
     } else {
@@ -601,7 +601,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
             Call(_, args) | MethodCall(_, _, args) => {
                 let mut tys = FxHashSet::default();
                 for arg in args {
-                    let def_id = arg.hir_id.owner_def_id();
+                    let def_id = arg.hir_id.owner.to_def_id();
                     if self.cx.tcx.has_typeck_tables(def_id)
                         && is_mutable_ty(
                             self.cx,
diff --git a/clippy_lints/src/inherent_impl.rs b/clippy_lints/src/inherent_impl.rs
index 355e75d0d559..cd034f916cef 100644
--- a/clippy_lints/src/inherent_impl.rs
+++ b/clippy_lints/src/inherent_impl.rs
@@ -59,7 +59,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
             // but filter out implementations that have generic params (type or lifetime)
             // or are derived from a macro
             if !in_macro(item.span) && generics.params.is_empty() {
-                self.impls.insert(item.hir_id.owner_def_id(), item.span);
+                self.impls.insert(item.hir_id.owner.to_def_id(), item.span);
             }
         }
     }
@@ -69,7 +69,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
             // Retrieve all inherent implementations from the crate, grouped by type
             for impls in cx
                 .tcx
-                .crate_inherent_impls(item.hir_id.owner_def_id().krate)
+                .crate_inherent_impls(item.hir_id.owner.to_def_id().krate)
                 .inherent_impls
                 .values()
             {
diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs
index 211d9034ffb7..475e60736e07 100644
--- a/clippy_lints/src/loops.rs
+++ b/clippy_lints/src/loops.rs
@@ -1679,7 +1679,7 @@ fn check_for_mutation(
         span_low: None,
         span_high: None,
     };
-    let def_id = def_id::DefId::local(body.hir_id.owner);
+    let def_id = body.hir_id.owner.to_def_id();
     cx.tcx.infer_ctxt().enter(|infcx| {
         ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(body);
     });
diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs
index 96750cb3b466..e03f9e36095b 100644
--- a/clippy_lints/src/missing_doc.rs
+++ b/clippy_lints/src/missing_doc.rs
@@ -135,7 +135,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
             hir::ItemKind::Fn(..) => {
                 // ignore main()
                 if it.ident.name == sym!(main) {
-                    let def_id = cx.tcx.hir().local_def_id(it.hir_id);
+                    let def_id = it.hir_id.owner;
                     let def_key = cx.tcx.hir().def_key(def_id);
                     if def_key.parent == Some(hir::def_id::CRATE_DEF_INDEX) {
                         return;
diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs
index adc93909677d..f69b145fa39f 100644
--- a/clippy_lints/src/new_without_default.rs
+++ b/clippy_lints/src/new_without_default.rs
@@ -149,9 +149,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
                                     if_chain! {
                                         if let Some(ref impling_types) = self.impling_types;
                                         if let Some(self_def) = cx.tcx.type_of(self_did).ty_adt_def();
-                                        if self_def.did.is_local();
+                                        if let Some(self_def_id) = self_def.did.as_local();
                                         then {
-                                            let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_def.did.to_local());
+                                            let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_def_id);
                                             if impling_types.contains(&self_id) {
                                                 return;
                                             }
diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs
index 05428f1a31fb..d532efbec749 100644
--- a/clippy_lints/src/swap.rs
+++ b/clippy_lints/src/swap.rs
@@ -99,7 +99,7 @@ fn check_manual_swap(cx: &LateContext<'_, '_>, block: &Block<'_>) {
             then {
                 if let ExprKind::Field(ref lhs1, _) = lhs1.kind {
                     if let ExprKind::Field(ref lhs2, _) = lhs2.kind {
-                        if lhs1.hir_id.owner_def_id() == lhs2.hir_id.owner_def_id() {
+                        if lhs1.hir_id.owner == lhs2.hir_id.owner {
                             return;
                         }
                     }
diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs
index 280e8e2f32e6..c1c5bcc1dd1b 100644
--- a/clippy_lints/src/utils/mod.rs
+++ b/clippy_lints/src/utils/mod.rs
@@ -297,8 +297,8 @@ pub fn qpath_res(cx: &LateContext<'_, '_>, qpath: &hir::QPath<'_>, id: hir::HirI
     match qpath {
         hir::QPath::Resolved(_, path) => path.res,
         hir::QPath::TypeRelative(..) => {
-            if cx.tcx.has_typeck_tables(id.owner_def_id()) {
-                cx.tcx.typeck_tables_of(id.owner_def_id()).qpath_res(qpath, id)
+            if cx.tcx.has_typeck_tables(id.owner.to_def_id()) {
+                cx.tcx.typeck_tables_of(id.owner.to_def_id()).qpath_res(qpath, id)
             } else {
                 Res::Err
             }
diff --git a/clippy_lints/src/utils/usage.rs b/clippy_lints/src/utils/usage.rs
index 7cde18fdb3b4..a08251c1a4eb 100644
--- a/clippy_lints/src/utils/usage.rs
+++ b/clippy_lints/src/utils/usage.rs
@@ -5,7 +5,7 @@ use rustc_ast::ast;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_hir::def::Res;
 use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
-use rustc_hir::{def_id, Expr, HirId, Path};
+use rustc_hir::{Expr, HirId, Path};
 use rustc_infer::infer::TyCtxtInferExt;
 use rustc_lint::LateContext;
 use rustc_span::symbol::Ident;
@@ -17,7 +17,7 @@ pub fn mutated_variables<'a, 'tcx>(expr: &'tcx Expr<'_>, cx: &'a LateContext<'a,
         used_mutably: FxHashSet::default(),
         skip: false,
     };
-    let def_id = def_id::DefId::local(expr.hir_id.owner);
+    let def_id = expr.hir_id.owner.to_def_id();
     cx.tcx.infer_ctxt().enter(|infcx| {
         ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(expr);
     });
diff --git a/clippy_lints/src/wildcard_imports.rs b/clippy_lints/src/wildcard_imports.rs
index 6f8cec7c0567..348d13ef41f1 100644
--- a/clippy_lints/src/wildcard_imports.rs
+++ b/clippy_lints/src/wildcard_imports.rs
@@ -85,7 +85,7 @@ impl LateLintPass<'_, '_> for WildcardImports {
             if let ItemKind::Use(use_path, UseKind::Glob) = &item.kind;
             // don't lint prelude glob imports
             if !use_path.segments.iter().last().map_or(false, |ps| ps.ident.as_str() == "prelude");
-            let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner_def_id());
+            let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner.to_def_id());
             if !used_imports.is_empty(); // Already handled by `unused_imports`
             then {
                 let mut applicability = Applicability::MachineApplicable;