Skip to content

Commit 978ed96

Browse files
authored
Rollup merge of #139232 - nnethercote:remove-Map-5, r=Zalathar
Move methods from `Map` to `TyCtxt`, part 5. This eliminates all methods on `Map`. Actually removing `Map` will occur in a follow-up PR. A follow-up to #137504. r? `@Zalathar`
2 parents 2e181e7 + 130af3f commit 978ed96

16 files changed

+22
-24
lines changed

clippy_lints/src/casts/unnecessary_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub(super) fn check<'tcx>(
143143

144144
if cast_from.kind() == cast_to.kind() && !expr.span.in_external_macro(cx.sess().source_map()) {
145145
if let Some(id) = path_to_local(cast_expr)
146-
&& !cx.tcx.hir().span(id).eq_ctxt(cast_expr.span)
146+
&& !cx.tcx.hir_span(id).eq_ctxt(cast_expr.span)
147147
{
148148
// Binding context is different than the identifiers context.
149149
// Weird macro wizardry could be involved here.

clippy_lints/src/derive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ fn check_hash_peq<'tcx>(
254254
|diag| {
255255
if let Some(local_def_id) = impl_id.as_local() {
256256
let hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id);
257-
diag.span_note(cx.tcx.hir().span(hir_id), "`PartialEq` implemented here");
257+
diag.span_note(cx.tcx.hir_span(hir_id), "`PartialEq` implemented here");
258258
}
259259
},
260260
);
@@ -298,7 +298,7 @@ fn check_ord_partial_ord<'tcx>(
298298
span_lint_and_then(cx, DERIVE_ORD_XOR_PARTIAL_ORD, span, mess, |diag| {
299299
if let Some(local_def_id) = impl_id.as_local() {
300300
let hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id);
301-
diag.span_note(cx.tcx.hir().span(hir_id), "`PartialOrd` implemented here");
301+
diag.span_note(cx.tcx.hir_span(hir_id), "`PartialOrd` implemented here");
302302
}
303303
});
304304
}

clippy_lints/src/escape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
120120
cx,
121121
BOXED_LOCAL,
122122
node,
123-
cx.tcx.hir().span(node),
123+
cx.tcx.hir_span(node),
124124
"local variable doesn't need to be boxed here",
125125
);
126126
}

clippy_lints/src/index_refutable_slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl<'tcx> Visitor<'tcx> for SliceIndexLintingVisitor<'_, 'tcx> {
248248
{
249249
use_info
250250
.index_use
251-
.push((index_value, cx.tcx.hir().span(parent_expr.hir_id)));
251+
.push((index_value, cx.tcx.hir_span(parent_expr.hir_id)));
252252
return;
253253
}
254254

clippy_lints/src/loops/mut_range_bound.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate<'_, 'tcx> {
8585
if bk == ty::BorrowKind::Mutable {
8686
if let PlaceBase::Local(id) = cmt.place.base {
8787
if Some(id) == self.hir_id_low && !BreakAfterExprVisitor::is_found(self.cx, diag_expr_id) {
88-
self.span_low = Some(self.cx.tcx.hir().span(diag_expr_id));
88+
self.span_low = Some(self.cx.tcx.hir_span(diag_expr_id));
8989
}
9090
if Some(id) == self.hir_id_high && !BreakAfterExprVisitor::is_found(self.cx, diag_expr_id) {
91-
self.span_high = Some(self.cx.tcx.hir().span(diag_expr_id));
91+
self.span_high = Some(self.cx.tcx.hir_span(diag_expr_id));
9292
}
9393
}
9494
}
@@ -97,10 +97,10 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate<'_, 'tcx> {
9797
fn mutate(&mut self, cmt: &PlaceWithHirId<'tcx>, diag_expr_id: HirId) {
9898
if let PlaceBase::Local(id) = cmt.place.base {
9999
if Some(id) == self.hir_id_low && !BreakAfterExprVisitor::is_found(self.cx, diag_expr_id) {
100-
self.span_low = Some(self.cx.tcx.hir().span(diag_expr_id));
100+
self.span_low = Some(self.cx.tcx.hir_span(diag_expr_id));
101101
}
102102
if Some(id) == self.hir_id_high && !BreakAfterExprVisitor::is_found(self.cx, diag_expr_id) {
103-
self.span_high = Some(self.cx.tcx.hir().span(diag_expr_id));
103+
self.span_high = Some(self.cx.tcx.hir_span(diag_expr_id));
104104
}
105105
}
106106
}

clippy_lints/src/macro_metavars_in_unsafe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl<'tcx> LateLintPass<'tcx> for ExprMetavarsInUnsafe {
253253
// Remove the syntax context to hide "in this macro invocation" in the diagnostic.
254254
// The invocation doesn't matter. Also we want to dedupe by the unsafe block and not by anything
255255
// related to the callsite.
256-
let span = cx.tcx.hir().span(id);
256+
let span = cx.tcx.hir_span(id);
257257

258258
(id, Span::new(span.lo(), span.hi(), SyntaxContext::root(), None))
259259
})

clippy_lints/src/misc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn used_underscore_binding<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
329329
let name = ident.name.as_str();
330330
if name.starts_with('_')
331331
&& !name.starts_with("__")
332-
&& let definition_span = cx.tcx.hir().span(definition_hir_id)
332+
&& let definition_span = cx.tcx.hir_span(definition_hir_id)
333333
&& !definition_span.from_expansion()
334334
&& !fulfill_or_allowed(cx, USED_UNDERSCORE_BINDING, [expr.hir_id, definition_hir_id])
335335
{

clippy_lints/src/needless_pass_by_ref_mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> {
280280
diag.span_suggestion(
281281
sp,
282282
"consider changing to".to_string(),
283-
format!("&{}", snippet(cx, cx.tcx.hir().span(inner_ty.ty.hir_id), "_"),),
283+
format!("&{}", snippet(cx, cx.tcx.hir_span(inner_ty.ty.hir_id), "_"),),
284284
Applicability::Unspecified,
285285
);
286286
if cx.effective_visibilities.is_exported(*fn_def_id) {

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
198198
// Dereference suggestion
199199
let sugg = |diag: &mut Diag<'_, ()>| {
200200
if let ty::Adt(def, ..) = ty.kind() {
201-
if let Some(span) = cx.tcx.hir().span_if_local(def.did()) {
201+
if let Some(span) = cx.tcx.hir_span_if_local(def.did()) {
202202
if type_allowed_to_implement_copy(
203203
cx.tcx,
204204
cx.param_env,

clippy_lints/src/operators/arithmetic_side_effects.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl<'tcx> LateLintPass<'tcx> for ArithmeticSideEffects {
354354

355355
let body_owner_kind = cx.tcx.hir_body_owner_kind(body_owner_def_id);
356356
if let hir::BodyOwnerKind::Const { .. } | hir::BodyOwnerKind::Static(_) = body_owner_kind {
357-
let body_span = cx.tcx.hir().span_with_body(body_owner);
357+
let body_span = cx.tcx.hir_span_with_body(body_owner);
358358
if let Some(span) = self.const_span
359359
&& span.contains(body_span)
360360
{
@@ -366,7 +366,7 @@ impl<'tcx> LateLintPass<'tcx> for ArithmeticSideEffects {
366366

367367
fn check_body_post(&mut self, cx: &LateContext<'_>, body: &hir::Body<'_>) {
368368
let body_owner = cx.tcx.hir_body_owner(body.id());
369-
let body_span = cx.tcx.hir().span(body_owner);
369+
let body_span = cx.tcx.hir_span(body_owner);
370370
if let Some(span) = self.const_span
371371
&& span.contains(body_span)
372372
{

0 commit comments

Comments
 (0)