about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-07-06 06:30:15 +0000
committerbors <bors@rust-lang.org>2019-07-06 06:30:15 +0000
commit8744e8ed26f3609c64c89b578e569366bfe1d551 (patch)
treeda8bebe5d63fdb8731e17a0674eebc5fa136ef00
parenta9f8d3a034b30d0a2bedfe99c107aeeefbf8e176 (diff)
parent481499101b96f4a8253501fb8fbc03d64e9b83b5 (diff)
downloadrust-8744e8ed26f3609c64c89b578e569366bfe1d551.tar.gz
rust-8744e8ed26f3609c64c89b578e569366bfe1d551.zip
Auto merge of #4254 - lzutao:hiridification-62168, r=Manishearth
Rustup HirIdification

Rustup https://github.com/rust-lang/rust/pull/62168

changelog: none
-rw-r--r--clippy_lints/src/cognitive_complexity.rs2
-rw-r--r--clippy_lints/src/copy_iterator.rs2
-rw-r--r--clippy_lints/src/derive.rs2
-rw-r--r--clippy_lints/src/empty_enum.rs2
-rw-r--r--clippy_lints/src/escape.rs2
-rw-r--r--clippy_lints/src/fallible_impl_from.rs4
-rw-r--r--clippy_lints/src/large_enum_variant.rs2
-rw-r--r--clippy_lints/src/len_zero.rs8
-rw-r--r--clippy_lints/src/loops.rs4
-rw-r--r--clippy_lints/src/methods/mod.rs2
-rw-r--r--clippy_lints/src/missing_const_for_fn.rs2
-rw-r--r--clippy_lints/src/missing_doc.rs4
-rw-r--r--clippy_lints/src/missing_inline.rs2
-rw-r--r--clippy_lints/src/needless_pass_by_value.rs2
-rw-r--r--clippy_lints/src/new_without_default.rs2
-rw-r--r--clippy_lints/src/ptr.rs2
-rw-r--r--clippy_lints/src/replace_consts.rs4
-rw-r--r--clippy_lints/src/trivially_copy_pass_by_ref.rs2
-rw-r--r--clippy_lints/src/use_self.rs4
-rw-r--r--clippy_lints/src/utils/inspector.rs4
-rw-r--r--clippy_lints/src/utils/mod.rs2
-rw-r--r--tests/ui/replace_consts.fixed5
-rw-r--r--tests/ui/replace_consts.rs5
-rw-r--r--tests/ui/replace_consts.stderr48
24 files changed, 53 insertions, 65 deletions
diff --git a/clippy_lints/src/cognitive_complexity.rs b/clippy_lints/src/cognitive_complexity.rs
index ea644450f6f..54947a6a671 100644
--- a/clippy_lints/src/cognitive_complexity.rs
+++ b/clippy_lints/src/cognitive_complexity.rs
@@ -118,7 +118,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CognitiveComplexity {
         span: Span,
         hir_id: HirId,
     ) {
-        let def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
+        let def_id = cx.tcx.hir().local_def_id(hir_id);
         if !cx.tcx.has_attr(def_id, sym!(test)) {
             self.check(cx, body, span);
         }
diff --git a/clippy_lints/src/copy_iterator.rs b/clippy_lints/src/copy_iterator.rs
index 79e30f1a7d8..cacf4563f11 100644
--- a/clippy_lints/src/copy_iterator.rs
+++ b/clippy_lints/src/copy_iterator.rs
@@ -34,7 +34,7 @@ declare_lint_pass!(CopyIterator => [COPY_ITERATOR]);
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyIterator {
     fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
         if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, _) = item.node {
-            let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id_from_hir_id(item.hir_id));
+            let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));
 
             if is_copy(cx, ty) && match_path(&trait_ref.path, &paths::ITERATOR) {
                 span_note_and_lint(
diff --git a/clippy_lints/src/derive.rs b/clippy_lints/src/derive.rs
index 68f235309ba..809dd0ee3ad 100644
--- a/clippy_lints/src/derive.rs
+++ b/clippy_lints/src/derive.rs
@@ -67,7 +67,7 @@ declare_lint_pass!(Derive => [EXPL_IMPL_CLONE_ON_COPY, DERIVE_HASH_XOR_EQ]);
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive {
     fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
         if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, _) = item.node {
-            let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id_from_hir_id(item.hir_id));
+            let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));
             let is_automatically_derived = is_automatically_derived(&*item.attrs);
 
             check_hash_peq(cx, item.span, trait_ref, ty, is_automatically_derived);
diff --git a/clippy_lints/src/empty_enum.rs b/clippy_lints/src/empty_enum.rs
index e8d25384ee6..80a1f9a9dba 100644
--- a/clippy_lints/src/empty_enum.rs
+++ b/clippy_lints/src/empty_enum.rs
@@ -27,7 +27,7 @@ declare_lint_pass!(EmptyEnum => [EMPTY_ENUM]);
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EmptyEnum {
     fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &Item) {
-        let did = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
+        let did = cx.tcx.hir().local_def_id(item.hir_id);
         if let ItemKind::Enum(..) = item.node {
             let ty = cx.tcx.type_of(did);
             let adt = ty.ty_adt_def().expect("already checked whether this is an enum");
diff --git a/clippy_lints/src/escape.rs b/clippy_lints/src/escape.rs
index e31ff586518..cc5f05ede1d 100644
--- a/clippy_lints/src/escape.rs
+++ b/clippy_lints/src/escape.rs
@@ -77,7 +77,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxedLocal {
             too_large_for_stack: self.too_large_for_stack,
         };
 
-        let fn_def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
+        let fn_def_id = cx.tcx.hir().local_def_id(hir_id);
         let region_scope_tree = &cx.tcx.region_scope_tree(fn_def_id);
         ExprUseVisitor::new(
             &mut v,
diff --git a/clippy_lints/src/fallible_impl_from.rs b/clippy_lints/src/fallible_impl_from.rs
index 1d2de8978fb..ed50969506c 100644
--- a/clippy_lints/src/fallible_impl_from.rs
+++ b/clippy_lints/src/fallible_impl_from.rs
@@ -33,7 +33,7 @@ declare_lint_pass!(FallibleImplFrom => [FALLIBLE_IMPL_FROM]);
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom {
     fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
         // check for `impl From<???> for ..`
-        let impl_def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
+        let impl_def_id = cx.tcx.hir().local_def_id(item.hir_id);
         if_chain! {
             if let hir::ItemKind::Impl(.., ref impl_items) = item.node;
             if let Some(impl_trait_ref) = cx.tcx.impl_trait_ref(impl_def_id);
@@ -95,7 +95,7 @@ fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_it
             then {
                 // check the body for `begin_panic` or `unwrap`
                 let body = cx.tcx.hir().body(body_id);
-                let impl_item_def_id = cx.tcx.hir().local_def_id_from_hir_id(impl_item.id.hir_id);
+                let impl_item_def_id = cx.tcx.hir().local_def_id(impl_item.id.hir_id);
                 let mut fpu = FindPanicUnwrap {
                     lcx: cx,
                     tables: cx.tcx.typeck_tables_of(impl_item_def_id),
diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs
index e447be82b03..b59b5850572 100644
--- a/clippy_lints/src/large_enum_variant.rs
+++ b/clippy_lints/src/large_enum_variant.rs
@@ -46,7 +46,7 @@ impl_lint_pass!(LargeEnumVariant => [LARGE_ENUM_VARIANT]);
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LargeEnumVariant {
     fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &Item) {
-        let did = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
+        let did = cx.tcx.hir().local_def_id(item.hir_id);
         if let ItemKind::Enum(ref def, _) = item.node {
             let ty = cx.tcx.type_of(did);
             let adt = ty.ty_adt_def().expect("already checked whether this is an enum");
diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs
index 3dc0765c637..be1c2a1128d 100644
--- a/clippy_lints/src/len_zero.rs
+++ b/clippy_lints/src/len_zero.rs
@@ -122,7 +122,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items
         item.ident.name.as_str() == name
             && if let AssocItemKind::Method { has_self } = item.kind {
                 has_self && {
-                    let did = cx.tcx.hir().local_def_id_from_hir_id(item.id.hir_id);
+                    let did = cx.tcx.hir().local_def_id(item.id.hir_id);
                     cx.tcx.fn_sig(did).inputs().skip_binder().len() == 1
                 }
             } else {
@@ -141,7 +141,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items
 
     if cx.access_levels.is_exported(visited_trait.hir_id) && trait_items.iter().any(|i| is_named_self(cx, i, "len")) {
         let mut current_and_super_traits = FxHashSet::default();
-        let visited_trait_def_id = cx.tcx.hir().local_def_id_from_hir_id(visited_trait.hir_id);
+        let visited_trait_def_id = cx.tcx.hir().local_def_id(visited_trait.hir_id);
         fill_trait_set(visited_trait_def_id, &mut current_and_super_traits, cx);
 
         let is_empty_method_found = current_and_super_traits
@@ -173,7 +173,7 @@ fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item, impl_items: &[ImplIte
         item.ident.name.as_str() == name
             && if let AssocItemKind::Method { has_self } = item.kind {
                 has_self && {
-                    let did = cx.tcx.hir().local_def_id_from_hir_id(item.id.hir_id);
+                    let did = cx.tcx.hir().local_def_id(item.id.hir_id);
                     cx.tcx.fn_sig(did).inputs().skip_binder().len() == 1
                 }
             } else {
@@ -193,7 +193,7 @@ fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item, impl_items: &[ImplIte
 
     if let Some(i) = impl_items.iter().find(|i| is_named_self(cx, i, "len")) {
         if cx.access_levels.is_exported(i.id.hir_id) {
-            let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
+            let def_id = cx.tcx.hir().local_def_id(item.hir_id);
             let ty = cx.tcx.type_of(def_id);
 
             span_lint(
diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs
index 2d7a641a831..fccf8694ec5 100644
--- a/clippy_lints/src/loops.rs
+++ b/clippy_lints/src/loops.rs
@@ -1102,7 +1102,7 @@ fn check_for_loop_range<'a, 'tcx>(
                 // ensure that the indexed variable was declared before the loop, see #601
                 if let Some(indexed_extent) = indexed_extent {
                     let parent_id = cx.tcx.hir().get_parent_item(expr.hir_id);
-                    let parent_def_id = cx.tcx.hir().local_def_id_from_hir_id(parent_id);
+                    let parent_def_id = cx.tcx.hir().local_def_id(parent_id);
                     let region_scope_tree = cx.tcx.region_scope_tree(parent_def_id);
                     let pat_extent = region_scope_tree.var_scope(pat.hir_id.local_id);
                     if region_scope_tree.is_subscope_of(indexed_extent, pat_extent) {
@@ -1792,7 +1792,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
                     match res {
                         Res::Local(hir_id) => {
                             let parent_id = self.cx.tcx.hir().get_parent_item(expr.hir_id);
-                            let parent_def_id = self.cx.tcx.hir().local_def_id_from_hir_id(parent_id);
+                            let parent_def_id = self.cx.tcx.hir().local_def_id(parent_id);
                             let extent = self.cx.tcx.region_scope_tree(parent_def_id).var_scope(hir_id.local_id);
                             if indexed_indirectly {
                                 self.indexed_indirectly.insert(seqvar.segments[0].ident.name, Some(extent));
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs
index 84492676d7d..f689a2d4ef0 100644
--- a/clippy_lints/src/methods/mod.rs
+++ b/clippy_lints/src/methods/mod.rs
@@ -948,7 +948,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
         let name = implitem.ident.name.as_str();
         let parent = cx.tcx.hir().get_parent_item(implitem.hir_id);
         let item = cx.tcx.hir().expect_item(parent);
-        let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
+        let def_id = cx.tcx.hir().local_def_id(item.hir_id);
         let ty = cx.tcx.type_of(def_id);
         if_chain! {
             if let hir::ImplItemKind::Method(ref sig, id) = implitem.node;
diff --git a/clippy_lints/src/missing_const_for_fn.rs b/clippy_lints/src/missing_const_for_fn.rs
index 54f34d64eb5..3eb5827472c 100644
--- a/clippy_lints/src/missing_const_for_fn.rs
+++ b/clippy_lints/src/missing_const_for_fn.rs
@@ -69,7 +69,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingConstForFn {
         span: Span,
         hir_id: HirId,
     ) {
-        let def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
+        let def_id = cx.tcx.hir().local_def_id(hir_id);
 
         if in_external_macro(cx.tcx.sess, span) || is_entrypoint_fn(cx, def_id) {
             return;
diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs
index 8cf08e3683b..195e787951a 100644
--- a/clippy_lints/src/missing_doc.rs
+++ b/clippy_lints/src/missing_doc.rs
@@ -133,7 +133,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_from_hir_id(it.hir_id);
+                    let def_id = cx.tcx.hir().local_def_id(it.hir_id);
                     let def_key = cx.tcx.hir().def_key(def_id);
                     if def_key.parent == Some(hir::def_id::CRATE_DEF_INDEX) {
                         return;
@@ -171,7 +171,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
 
     fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem) {
         // If the method is an impl for a trait, don't doc.
-        let def_id = cx.tcx.hir().local_def_id_from_hir_id(impl_item.hir_id);
+        let def_id = cx.tcx.hir().local_def_id(impl_item.hir_id);
         match cx.tcx.associated_item(def_id).container {
             ty::TraitContainer(_) => return,
             ty::ImplContainer(cid) => {
diff --git a/clippy_lints/src/missing_inline.rs b/clippy_lints/src/missing_inline.rs
index 95eae7b8427..3efbfbb700d 100644
--- a/clippy_lints/src/missing_inline.rs
+++ b/clippy_lints/src/missing_inline.rs
@@ -145,7 +145,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
             hir::ImplItemKind::Const(..) | hir::ImplItemKind::Type(_) | hir::ImplItemKind::Existential(_) => return,
         };
 
-        let def_id = cx.tcx.hir().local_def_id_from_hir_id(impl_item.hir_id);
+        let def_id = cx.tcx.hir().local_def_id(impl_item.hir_id);
         let trait_def_id = match cx.tcx.associated_item(def_id).container {
             TraitContainer(cid) => Some(cid),
             ImplContainer(cid) => cx.tcx.impl_trait_ref(cid).map(|t| t.def_id),
diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs
index 84dd26647ba..5098fa2a736 100644
--- a/clippy_lints/src/needless_pass_by_value.rs
+++ b/clippy_lints/src/needless_pass_by_value.rs
@@ -107,7 +107,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
 
         let sized_trait = need!(cx.tcx.lang_items().sized_trait());
 
-        let fn_def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
+        let fn_def_id = cx.tcx.hir().local_def_id(hir_id);
 
         let preds = traits::elaborate_predicates(cx.tcx, cx.param_env.caller_bounds.to_vec())
             .filter(|p| !p.is_global())
diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs
index 68d357a7572..b2bfb51d6f9 100644
--- a/clippy_lints/src/new_without_default.rs
+++ b/clippy_lints/src/new_without_default.rs
@@ -121,7 +121,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
                             return;
                         }
                         if sig.decl.inputs.is_empty() && name == sym!(new) && cx.access_levels.is_reachable(id) {
-                            let self_did = cx.tcx.hir().local_def_id_from_hir_id(cx.tcx.hir().get_parent_item(id));
+                            let self_did = cx.tcx.hir().local_def_id(cx.tcx.hir().get_parent_item(id));
                             let self_ty = cx.tcx.type_of(self_did);
                             if_chain! {
                                 if same_tys(cx, self_ty, return_ty(cx, id));
diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs
index ff49ee95208..854bb718e3e 100644
--- a/clippy_lints/src/ptr.rs
+++ b/clippy_lints/src/ptr.rs
@@ -142,7 +142,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr {
 
 #[allow(clippy::too_many_lines)]
 fn check_fn(cx: &LateContext<'_, '_>, decl: &FnDecl, fn_id: HirId, opt_body_id: Option<BodyId>) {
-    let fn_def_id = cx.tcx.hir().local_def_id_from_hir_id(fn_id);
+    let fn_def_id = cx.tcx.hir().local_def_id(fn_id);
     let sig = cx.tcx.fn_sig(fn_def_id);
     let fn_ty = sig.skip_binder();
 
diff --git a/clippy_lints/src/replace_consts.rs b/clippy_lints/src/replace_consts.rs
index c15eca15c1b..cb7be85ab39 100644
--- a/clippy_lints/src/replace_consts.rs
+++ b/clippy_lints/src/replace_consts.rs
@@ -56,9 +56,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ReplaceConsts {
     }
 }
 
-const REPLACEMENTS: [([&str; 3], &str); 25] = [
-    // Once
-    (["core", "sync", "ONCE_INIT"], "Once::new()"),
+const REPLACEMENTS: [([&str; 3], &str); 24] = [
     // Min
     (["core", "isize", "MIN"], "isize::min_value()"),
     (["core", "i8", "MIN"], "i8::min_value()"),
diff --git a/clippy_lints/src/trivially_copy_pass_by_ref.rs b/clippy_lints/src/trivially_copy_pass_by_ref.rs
index 93e00778fec..4e07a07ccc2 100644
--- a/clippy_lints/src/trivially_copy_pass_by_ref.rs
+++ b/clippy_lints/src/trivially_copy_pass_by_ref.rs
@@ -73,7 +73,7 @@ impl<'a, 'tcx> TriviallyCopyPassByRef {
     }
 
     fn check_poly_fn(&mut self, cx: &LateContext<'_, 'tcx>, hir_id: HirId, decl: &FnDecl, span: Option<Span>) {
-        let fn_def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
+        let fn_def_id = cx.tcx.hir().local_def_id(hir_id);
 
         let fn_sig = cx.tcx.fn_sig(fn_def_id);
         let fn_sig = cx.tcx.erase_late_bound_regions(&fn_sig);
diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs
index 96e725c4229..b60b9ccab32 100644
--- a/clippy_lints/src/use_self.rs
+++ b/clippy_lints/src/use_self.rs
@@ -129,7 +129,7 @@ fn check_trait_method_impl_decl<'a, 'tcx>(
     let trait_method_sig = cx.tcx.fn_sig(trait_method.def_id);
     let trait_method_sig = cx.tcx.erase_late_bound_regions(&trait_method_sig);
 
-    let impl_method_def_id = cx.tcx.hir().local_def_id_from_hir_id(impl_item.hir_id);
+    let impl_method_def_id = cx.tcx.hir().local_def_id(impl_item.hir_id);
     let impl_method_sig = cx.tcx.fn_sig(impl_method_def_id);
     let impl_method_sig = cx.tcx.erase_late_bound_regions(&impl_method_sig);
 
@@ -184,7 +184,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UseSelf {
                         item_path,
                         cx,
                     };
-                    let impl_def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
+                    let impl_def_id = cx.tcx.hir().local_def_id(item.hir_id);
                     let impl_trait_ref = cx.tcx.impl_trait_ref(impl_def_id);
 
                     if let Some(impl_trait_ref) = impl_trait_ref {
diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs
index f7b865bd2ca..00edb4fafcb 100644
--- a/clippy_lints/src/utils/inspector.rs
+++ b/clippy_lints/src/utils/inspector.rs
@@ -329,7 +329,7 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) {
 }
 
 fn print_item(cx: &LateContext<'_, '_>, item: &hir::Item) {
-    let did = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
+    let did = cx.tcx.hir().local_def_id(item.hir_id);
     println!("item `{}`", item.ident.name);
     match item.vis.node {
         hir::VisibilityKind::Public => println!("public"),
@@ -342,7 +342,7 @@ fn print_item(cx: &LateContext<'_, '_>, item: &hir::Item) {
     }
     match item.node {
         hir::ItemKind::ExternCrate(ref _renamed_from) => {
-            let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
+            let def_id = cx.tcx.hir().local_def_id(item.hir_id);
             if let Some(crate_id) = cx.tcx.extern_mod_stmt_cnum(def_id) {
                 let source = cx.tcx.used_crate_source(crate_id);
                 if let Some(ref src) = source.dylib {
diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs
index 4647058ddfb..53665506c39 100644
--- a/clippy_lints/src/utils/mod.rs
+++ b/clippy_lints/src/utils/mod.rs
@@ -716,7 +716,7 @@ pub fn is_direct_expn_of(span: Span, name: &str) -> Option<Span> {
 
 /// Convenience function to get the return type of a function.
 pub fn return_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, fn_item: hir::HirId) -> Ty<'tcx> {
-    let fn_def_id = cx.tcx.hir().local_def_id_from_hir_id(fn_item);
+    let fn_def_id = cx.tcx.hir().local_def_id(fn_item);
     let ret_ty = cx.tcx.fn_sig(fn_def_id).output();
     cx.tcx.erase_late_bound_regions(&ret_ty)
 }
diff --git a/tests/ui/replace_consts.fixed b/tests/ui/replace_consts.fixed
index 2c125f978d9..db312665410 100644
--- a/tests/ui/replace_consts.fixed
+++ b/tests/ui/replace_consts.fixed
@@ -4,12 +4,9 @@
 #![deny(clippy::replace_consts)]
 
 use std::sync::atomic::*;
-use std::sync::{Once, ONCE_INIT};
 
 #[rustfmt::skip]
 fn bad() {
-    // Once
-    { let foo = ONCE_INIT; };
     // Min
     { let foo = isize::min_value(); };
     { let foo = i8::min_value(); };
@@ -40,8 +37,6 @@ fn bad() {
 
 #[rustfmt::skip]
 fn good() {
-    // Once
-    { let foo = Once::new(); };
     // Atomic
     { let foo = AtomicBool::new(false); };
     { let foo = AtomicIsize::new(0); };
diff --git a/tests/ui/replace_consts.rs b/tests/ui/replace_consts.rs
index 3c7d8d07ed6..0c8440e7675 100644
--- a/tests/ui/replace_consts.rs
+++ b/tests/ui/replace_consts.rs
@@ -4,12 +4,9 @@
 #![deny(clippy::replace_consts)]
 
 use std::sync::atomic::*;
-use std::sync::{Once, ONCE_INIT};
 
 #[rustfmt::skip]
 fn bad() {
-    // Once
-    { let foo = ONCE_INIT; };
     // Min
     { let foo = std::isize::MIN; };
     { let foo = std::i8::MIN; };
@@ -40,8 +37,6 @@ fn bad() {
 
 #[rustfmt::skip]
 fn good() {
-    // Once
-    { let foo = Once::new(); };
     // Atomic
     { let foo = AtomicBool::new(false); };
     { let foo = AtomicIsize::new(0); };
diff --git a/tests/ui/replace_consts.stderr b/tests/ui/replace_consts.stderr
index be0d0072623..b0d0788a918 100644
--- a/tests/ui/replace_consts.stderr
+++ b/tests/ui/replace_consts.stderr
@@ -1,5 +1,5 @@
 error: using `MIN`
-  --> $DIR/replace_consts.rs:14:17
+  --> $DIR/replace_consts.rs:11:17
    |
 LL |     { let foo = std::isize::MIN; };
    |                 ^^^^^^^^^^^^^^^ help: try this: `isize::min_value()`
@@ -11,139 +11,139 @@ LL | #![deny(clippy::replace_consts)]
    |         ^^^^^^^^^^^^^^^^^^^^^^
 
 error: using `MIN`
-  --> $DIR/replace_consts.rs:15:17
+  --> $DIR/replace_consts.rs:12:17
    |
 LL |     { let foo = std::i8::MIN; };
    |                 ^^^^^^^^^^^^ help: try this: `i8::min_value()`
 
 error: using `MIN`
-  --> $DIR/replace_consts.rs:16:17
+  --> $DIR/replace_consts.rs:13:17
    |
 LL |     { let foo = std::i16::MIN; };
    |                 ^^^^^^^^^^^^^ help: try this: `i16::min_value()`
 
 error: using `MIN`
-  --> $DIR/replace_consts.rs:17:17
+  --> $DIR/replace_consts.rs:14:17
    |
 LL |     { let foo = std::i32::MIN; };
    |                 ^^^^^^^^^^^^^ help: try this: `i32::min_value()`
 
 error: using `MIN`
-  --> $DIR/replace_consts.rs:18:17
+  --> $DIR/replace_consts.rs:15:17
    |
 LL |     { let foo = std::i64::MIN; };
    |                 ^^^^^^^^^^^^^ help: try this: `i64::min_value()`
 
 error: using `MIN`
-  --> $DIR/replace_consts.rs:19:17
+  --> $DIR/replace_consts.rs:16:17
    |
 LL |     { let foo = std::i128::MIN; };
    |                 ^^^^^^^^^^^^^^ help: try this: `i128::min_value()`
 
 error: using `MIN`
-  --> $DIR/replace_consts.rs:20:17
+  --> $DIR/replace_consts.rs:17:17
    |
 LL |     { let foo = std::usize::MIN; };
    |                 ^^^^^^^^^^^^^^^ help: try this: `usize::min_value()`
 
 error: using `MIN`
-  --> $DIR/replace_consts.rs:21:17
+  --> $DIR/replace_consts.rs:18:17
    |
 LL |     { let foo = std::u8::MIN; };
    |                 ^^^^^^^^^^^^ help: try this: `u8::min_value()`
 
 error: using `MIN`
-  --> $DIR/replace_consts.rs:22:17
+  --> $DIR/replace_consts.rs:19:17
    |
 LL |     { let foo = std::u16::MIN; };
    |                 ^^^^^^^^^^^^^ help: try this: `u16::min_value()`
 
 error: using `MIN`
-  --> $DIR/replace_consts.rs:23:17
+  --> $DIR/replace_consts.rs:20:17
    |
 LL |     { let foo = std::u32::MIN; };
    |                 ^^^^^^^^^^^^^ help: try this: `u32::min_value()`
 
 error: using `MIN`
-  --> $DIR/replace_consts.rs:24:17
+  --> $DIR/replace_consts.rs:21:17
    |
 LL |     { let foo = std::u64::MIN; };
    |                 ^^^^^^^^^^^^^ help: try this: `u64::min_value()`
 
 error: using `MIN`
-  --> $DIR/replace_consts.rs:25:17
+  --> $DIR/replace_consts.rs:22:17
    |
 LL |     { let foo = std::u128::MIN; };
    |                 ^^^^^^^^^^^^^^ help: try this: `u128::min_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:27:17
+  --> $DIR/replace_consts.rs:24:17
    |
 LL |     { let foo = std::isize::MAX; };
    |                 ^^^^^^^^^^^^^^^ help: try this: `isize::max_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:28:17
+  --> $DIR/replace_consts.rs:25:17
    |
 LL |     { let foo = std::i8::MAX; };
    |                 ^^^^^^^^^^^^ help: try this: `i8::max_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:29:17
+  --> $DIR/replace_consts.rs:26:17
    |
 LL |     { let foo = std::i16::MAX; };
    |                 ^^^^^^^^^^^^^ help: try this: `i16::max_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:30:17
+  --> $DIR/replace_consts.rs:27:17
    |
 LL |     { let foo = std::i32::MAX; };
    |                 ^^^^^^^^^^^^^ help: try this: `i32::max_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:31:17
+  --> $DIR/replace_consts.rs:28:17
    |
 LL |     { let foo = std::i64::MAX; };
    |                 ^^^^^^^^^^^^^ help: try this: `i64::max_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:32:17
+  --> $DIR/replace_consts.rs:29:17
    |
 LL |     { let foo = std::i128::MAX; };
    |                 ^^^^^^^^^^^^^^ help: try this: `i128::max_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:33:17
+  --> $DIR/replace_consts.rs:30:17
    |
 LL |     { let foo = std::usize::MAX; };
    |                 ^^^^^^^^^^^^^^^ help: try this: `usize::max_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:34:17
+  --> $DIR/replace_consts.rs:31:17
    |
 LL |     { let foo = std::u8::MAX; };
    |                 ^^^^^^^^^^^^ help: try this: `u8::max_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:35:17
+  --> $DIR/replace_consts.rs:32:17
    |
 LL |     { let foo = std::u16::MAX; };
    |                 ^^^^^^^^^^^^^ help: try this: `u16::max_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:36:17
+  --> $DIR/replace_consts.rs:33:17
    |
 LL |     { let foo = std::u32::MAX; };
    |                 ^^^^^^^^^^^^^ help: try this: `u32::max_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:37:17
+  --> $DIR/replace_consts.rs:34:17
    |
 LL |     { let foo = std::u64::MAX; };
    |                 ^^^^^^^^^^^^^ help: try this: `u64::max_value()`
 
 error: using `MAX`
-  --> $DIR/replace_consts.rs:38:17
+  --> $DIR/replace_consts.rs:35:17
    |
 LL |     { let foo = std::u128::MAX; };
    |                 ^^^^^^^^^^^^^^ help: try this: `u128::max_value()`