Skip to content

Commit bf86fe1

Browse files
committed
rustc: hir().local_def_id_to_hir_id() -> tcx.local_def_id_to_hir_id() cleanup
1 parent a79a7d6 commit bf86fe1

24 files changed

+32
-32
lines changed

clippy_lints/src/derive.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ fn check_hash_peq<'tcx>(
255255
"you are deriving `Hash` but have implemented `PartialEq` explicitly",
256256
|diag| {
257257
if let Some(local_def_id) = impl_id.as_local() {
258-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
258+
let hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id);
259259
diag.span_note(cx.tcx.hir().span(hir_id), "`PartialEq` implemented here");
260260
}
261261
},
@@ -299,7 +299,7 @@ fn check_ord_partial_ord<'tcx>(
299299

300300
span_lint_and_then(cx, DERIVE_ORD_XOR_PARTIAL_ORD, span, mess, |diag| {
301301
if let Some(local_def_id) = impl_id.as_local() {
302-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
302+
let hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id);
303303
diag.span_note(cx.tcx.hir().span(hir_id), "`PartialOrd` implemented here");
304304
}
305305
});
@@ -381,7 +381,7 @@ fn check_unsafe_derive_deserialize<'tcx>(
381381
&& match_def_path(cx, trait_def_id, &paths::SERDE_DESERIALIZE)
382382
&& let ty::Adt(def, _) = ty.kind()
383383
&& let Some(local_def_id) = def.did().as_local()
384-
&& let adt_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id)
384+
&& let adt_hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id)
385385
&& !is_lint_allowed(cx, UNSAFE_DERIVE_DESERIALIZE, adt_hir_id)
386386
&& cx
387387
.tcx

clippy_lints/src/error_impl_error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'tcx> LateLintPass<'tcx> for ErrorImplError {
5858
if let Some(trait_def_id) = imp.of_trait.and_then(|t| t.trait_def_id())
5959
&& error_def_id == trait_def_id
6060
&& let Some(def_id) = path_res(cx, imp.self_ty).opt_def_id().and_then(DefId::as_local)
61-
&& let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id)
61+
&& let hir_id = cx.tcx.local_def_id_to_hir_id(def_id)
6262
&& let Some(ident) = cx.tcx.opt_item_ident(def_id.to_def_id())
6363
&& ident.name == sym::Error
6464
&& is_visible_outside_module(cx, def_id) =>

clippy_lints/src/escape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
7474
let parent_id = cx
7575
.tcx
7676
.hir()
77-
.get_parent_item(cx.tcx.hir().local_def_id_to_hir_id(fn_def_id))
77+
.get_parent_item(cx.tcx.local_def_id_to_hir_id(fn_def_id))
7878
.def_id;
7979
let parent_node = cx.tcx.hir().find_by_def_id(parent_id);
8080

clippy_lints/src/excessive_bools.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'tcx> LateLintPass<'tcx> for ExcessiveBools {
171171
span: Span,
172172
def_id: LocalDefId,
173173
) {
174-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
174+
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
175175
if let Some(fn_header) = fn_kind.header()
176176
&& fn_header.abi == Abi::Rust
177177
&& get_parent_as_impl(cx.tcx, hir_id).map_or(true, |impl_item| impl_item.of_trait.is_none())

clippy_lints/src/functions/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl<'tcx> LateLintPass<'tcx> for Functions {
407407
span: Span,
408408
def_id: LocalDefId,
409409
) {
410-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
410+
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
411411
too_many_arguments::check_fn(cx, kind, decl, span, hir_id, self.too_many_arguments_threshold);
412412
too_many_lines::check_fn(cx, kind, span, body, self.too_many_lines_threshold);
413413
not_unsafe_ptr_arg_deref::check_fn(cx, kind, decl, body, def_id);

clippy_lints/src/future_not_send.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
6262
if let FnKind::Closure = kind {
6363
return;
6464
}
65-
let ret_ty = return_ty(cx, cx.tcx.hir().local_def_id_to_hir_id(fn_def_id).expect_owner());
65+
let ret_ty = return_ty(cx, cx.tcx.local_def_id_to_hir_id(fn_def_id).expect_owner());
6666
if let ty::Alias(ty::Opaque, AliasTy { def_id, args, .. }) = *ret_ty.kind() {
6767
let preds = cx.tcx.explicit_item_bounds(def_id);
6868
let mut is_future = false;

clippy_lints/src/inherent_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
6363
&& !is_lint_allowed(
6464
cx,
6565
MULTIPLE_INHERENT_IMPL,
66-
cx.tcx.hir().local_def_id_to_hir_id(id),
66+
cx.tcx.local_def_id_to_hir_id(id),
6767
)
6868
}) {
6969
for impl_id in impl_ids.iter().map(|id| id.expect_local()) {
@@ -117,7 +117,7 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
117117

118118
/// Gets the span for the given impl block unless it's not being considered by the lint.
119119
fn get_impl_span(cx: &LateContext<'_>, id: LocalDefId) -> Option<Span> {
120-
let id = cx.tcx.hir().local_def_id_to_hir_id(id);
120+
let id = cx.tcx.local_def_id_to_hir_id(id);
121121
if let Node::Item(&Item {
122122
kind: ItemKind::Impl(impl_item),
123123
span,

clippy_lints/src/len_zero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
142142
&& let TyKind::Path(ty_path) = &imp.self_ty.kind
143143
&& let Some(ty_id) = cx.qpath_res(ty_path, imp.self_ty.hir_id).opt_def_id()
144144
&& let Some(local_id) = ty_id.as_local()
145-
&& let ty_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_id)
145+
&& let ty_hir_id = cx.tcx.local_def_id_to_hir_id(local_id)
146146
&& !is_lint_allowed(cx, LEN_WITHOUT_IS_EMPTY, ty_hir_id)
147147
&& let Some(output) =
148148
parse_len_output(cx, cx.tcx.fn_sig(item.owner_id).instantiate_identity().skip_binder())

clippy_lints/src/manual_non_exhaustive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustiveEnum {
192192
.contains(&(enum_id.to_def_id(), variant_id.to_def_id()))
193193
})
194194
{
195-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(enum_id);
195+
let hir_id = cx.tcx.local_def_id_to_hir_id(enum_id);
196196
span_lint_hir_and_then(
197197
cx,
198198
MANUAL_NON_EXHAUSTIVE,

clippy_lints/src/methods/filter_map_bool_then.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, arg: &
2727
closure.def_id.to_def_id(),
2828
Binder::bind_with_vars(
2929
cx.typeck_results().node_type(param_ty.hir_id),
30-
cx.tcx.late_bound_vars(cx.tcx.hir().local_def_id_to_hir_id(closure.def_id)),
30+
cx.tcx.late_bound_vars(cx.tcx.local_def_id_to_hir_id(closure.def_id)),
3131
),
3232
)
3333
&& is_copy(cx, param_ty)

0 commit comments

Comments
 (0)