Skip to content

Commit 429a1ce

Browse files
committed
merge as_local_hir_id with local_def_id_to_hir_id
1 parent fdc2f87 commit 429a1ce

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clippy_lints/src/derive.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ fn check_hash_peq<'tcx>(
224224
mess,
225225
|diag| {
226226
if let Some(local_def_id) = impl_id.as_local() {
227-
let hir_id = cx.tcx.hir().as_local_hir_id(local_def_id);
227+
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
228228
diag.span_note(
229229
cx.tcx.hir().span(hir_id),
230230
"`PartialEq` implemented here"
@@ -278,7 +278,7 @@ fn check_ord_partial_ord<'tcx>(
278278
mess,
279279
|diag| {
280280
if let Some(local_def_id) = impl_id.as_local() {
281-
let hir_id = cx.tcx.hir().as_local_hir_id(local_def_id);
281+
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
282282
diag.span_note(
283283
cx.tcx.hir().span(hir_id),
284284
"`PartialOrd` implemented here"
@@ -341,7 +341,7 @@ fn check_unsafe_derive_deserialize<'tcx>(
341341
ty: Ty<'tcx>,
342342
) {
343343
fn item_from_def_id<'tcx>(cx: &LateContext<'tcx>, def_id: DefId) -> &'tcx Item<'tcx> {
344-
let hir_id = cx.tcx.hir().as_local_hir_id(def_id.expect_local());
344+
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
345345
cx.tcx.hir().expect_item(hir_id)
346346
}
347347

@@ -355,7 +355,7 @@ fn check_unsafe_derive_deserialize<'tcx>(
355355
if match_path(&trait_ref.path, &paths::SERDE_DESERIALIZE);
356356
if let ty::Adt(def, _) = ty.kind;
357357
if let Some(local_def_id) = def.did.as_local();
358-
let adt_hir_id = cx.tcx.hir().as_local_hir_id(local_def_id);
358+
let adt_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
359359
if !is_allowed(cx, UNSAFE_DERIVE_DESERIALIZE, adt_hir_id);
360360
if cx.tcx.inherent_impls(def.did)
361361
.iter()

clippy_lints/src/new_without_default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl<'tcx> LateLintPass<'tcx> for NewWithoutDefault {
103103
cx.tcx.for_each_impl(default_trait_id, |d| {
104104
if let Some(ty_def) = cx.tcx.type_of(d).ty_adt_def() {
105105
if let Some(local_def_id) = ty_def.did.as_local() {
106-
impls.insert(cx.tcx.hir().as_local_hir_id(local_def_id));
106+
impls.insert(cx.tcx.hir().local_def_id_to_hir_id(local_def_id));
107107
}
108108
}
109109
});

0 commit comments

Comments
 (0)