Skip to content

Commit bddba23

Browse files
committed
s/tcx.hir/tcx.map
1 parent b1be0d6 commit bddba23

33 files changed

+77
-77
lines changed

clippy_lints/src/assign_ops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
143143
return; // useless if the trait doesn't exist
144144
};
145145
// check that we are not inside an `impl AssignOp` of this exact operation
146-
let parent_fn = cx.tcx.map.get_parent(e.id);
147-
let parent_impl = cx.tcx.map.get_parent(parent_fn);
146+
let parent_fn = cx.tcx.hir.get_parent(e.id);
147+
let parent_impl = cx.tcx.hir.get_parent(parent_fn);
148148
// the crate node is the only one that is not in the map
149149
if_let_chain!{[
150150
parent_impl != ast::CRATE_NODE_ID,
151-
let hir::map::Node::NodeItem(item) = cx.tcx.map.get(parent_impl),
151+
let hir::map::Node::NodeItem(item) = cx.tcx.hir.get(parent_impl),
152152
let hir::Item_::ItemImpl(_, _, _, Some(ref trait_ref), _, _) = item.node,
153153
trait_ref.path.def.def_id() == trait_id
154154
], { return; }}

clippy_lints/src/attrs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
158158

159159
fn is_relevant_item(tcx: ty::TyCtxt, item: &Item) -> bool {
160160
if let ItemFn(_, _, _, _, _, eid) = item.node {
161-
is_relevant_expr(tcx, tcx.body_tables(eid), &tcx.map.body(eid).value)
161+
is_relevant_expr(tcx, tcx.body_tables(eid), &tcx.hir.body(eid).value)
162162
} else {
163163
false
164164
}
165165
}
166166

167167
fn is_relevant_impl(tcx: ty::TyCtxt, item: &ImplItem) -> bool {
168168
match item.node {
169-
ImplItemKind::Method(_, eid) => is_relevant_expr(tcx, tcx.body_tables(eid), &tcx.map.body(eid).value),
169+
ImplItemKind::Method(_, eid) => is_relevant_expr(tcx, tcx.body_tables(eid), &tcx.hir.body(eid).value),
170170
_ => false,
171171
}
172172
}
@@ -175,7 +175,7 @@ fn is_relevant_trait(tcx: ty::TyCtxt, item: &TraitItem) -> bool {
175175
match item.node {
176176
TraitItemKind::Method(_, TraitMethod::Required(_)) => true,
177177
TraitItemKind::Method(_, TraitMethod::Provided(eid)) => {
178-
is_relevant_expr(tcx, tcx.body_tables(eid), &tcx.map.body(eid).value)
178+
is_relevant_expr(tcx, tcx.body_tables(eid), &tcx.hir.body(eid).value)
179179
},
180180
_ => false,
181181
}

clippy_lints/src/block_in_if_condition.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct ExVisitor<'a, 'tcx: 'a> {
5757
impl<'a, 'tcx: 'a> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
5858
fn visit_expr(&mut self, expr: &'tcx Expr) {
5959
if let ExprClosure(_, _, eid, _) = expr.node {
60-
let body = self.cx.tcx.map.body(eid);
60+
let body = self.cx.tcx.hir.body(eid);
6161
let ex = &body.value;
6262
if matches!(ex.node, ExprBlock(_)) {
6363
self.found_block = Some(ex);
@@ -67,7 +67,7 @@ impl<'a, 'tcx: 'a> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
6767
walk_expr(self, expr);
6868
}
6969
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
70-
NestedVisitorMap::All(&self.cx.tcx.map)
70+
NestedVisitorMap::All(&self.cx.tcx.hir)
7171
}
7272
}
7373

clippy_lints/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
263263
ExprRepeat(ref value, number_id) => {
264264
if let Some(lcx) = self.lcx {
265265
self.binop_apply(value,
266-
&lcx.tcx.map.body(number_id).value,
266+
&lcx.tcx.hir.body(number_id).value,
267267
|v, n| Some(Constant::Repeat(Box::new(v), n.as_u64() as usize)))
268268
} else {
269269
None

clippy_lints/src/cyclomatic_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CyclomaticComplexity {
9999
span: Span,
100100
node_id: NodeId
101101
) {
102-
let def_id = cx.tcx.map.local_def_id(node_id);
102+
let def_id = cx.tcx.hir.local_def_id(node_id);
103103
if !cx.tcx.has_attr(def_id, "test") {
104104
self.check(cx, &body.value, span);
105105
}

clippy_lints/src/derive.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl LintPass for Derive {
7373
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive {
7474
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
7575
if let ItemImpl(_, _, _, Some(ref trait_ref), _, _) = item.node {
76-
let ty = cx.tcx.item_type(cx.tcx.map.local_def_id(item.id));
76+
let ty = cx.tcx.item_type(cx.tcx.hir.local_def_id(item.id));
7777
let is_automatically_derived = is_automatically_derived(&*item.attrs);
7878

7979
check_hash_peq(cx, item.span, trait_ref, ty, is_automatically_derived);
@@ -122,9 +122,9 @@ fn check_hash_peq<'a, 'tcx>(
122122
cx, DERIVE_HASH_XOR_EQ, span,
123123
mess,
124124
|db| {
125-
if let Some(node_id) = cx.tcx.map.as_local_node_id(impl_id) {
125+
if let Some(node_id) = cx.tcx.hir.as_local_node_id(impl_id) {
126126
db.span_note(
127-
cx.tcx.map.span(node_id),
127+
cx.tcx.hir.span(node_id),
128128
"`PartialEq` implemented here"
129129
);
130130
}

clippy_lints/src/entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,6 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for InsertVisitor<'a, 'tcx, 'b> {
148148
}
149149
}
150150
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
151-
NestedVisitorMap::All(&self.cx.tcx.map)
151+
NestedVisitorMap::All(&self.cx.tcx.hir)
152152
}
153153
}

clippy_lints/src/enum_clike.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
4545
if let Some(body_id) = variant.disr_expr {
4646
use rustc_const_eval::*;
4747
let constcx = ConstContext::new(cx.tcx, body_id);
48-
let bad = match constcx.eval(&cx.tcx.map.body(body_id).value, EvalHint::ExprTypeChecked) {
48+
let bad = match constcx.eval(&cx.tcx.hir.body(body_id).value, EvalHint::ExprTypeChecked) {
4949
Ok(ConstVal::Integral(Usize(Us64(i)))) => i as u32 as u64 != i,
5050
Ok(ConstVal::Integral(Isize(Is64(i)))) => i as i32 as i64 != i,
5151
_ => false,

clippy_lints/src/escape.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
8989
for node in v.set {
9090
span_lint(cx,
9191
BOXED_LOCAL,
92-
cx.tcx.map.span(node),
92+
cx.tcx.hir.span(node),
9393
"local variable doesn't need to be boxed here");
9494
}
9595
}
@@ -108,7 +108,7 @@ impl<'a, 'tcx: 'a> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
108108
}
109109
fn matched_pat(&mut self, _: &Pat, _: cmt<'tcx>, _: MatchMode) {}
110110
fn consume_pat(&mut self, consume_pat: &Pat, cmt: cmt<'tcx>, _: ConsumeMode) {
111-
let map = &self.tcx.map;
111+
let map = &self.tcx.hir;
112112
if map.is_argument(consume_pat.id) {
113113
// Skip closure arguments
114114
if let Some(NodeExpr(..)) = map.find(map.get_parent_node(consume_pat.id)) {
@@ -180,7 +180,7 @@ impl<'a, 'tcx: 'a> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
180180
self.tables
181181
.adjustments
182182
.get(&self.tcx
183-
.map
183+
.hir
184184
.get_parent_node(borrow_id))
185185
.map(|a| &a.kind) {
186186
if autoderefs <= 1 {

clippy_lints/src/eta_reduction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaPass {
4949

5050
fn check_closure(cx: &LateContext, expr: &Expr) {
5151
if let ExprClosure(_, ref decl, eid, _) = expr.node {
52-
let body = cx.tcx.map.body(eid);
52+
let body = cx.tcx.hir.body(eid);
5353
let ex = &body.value;
5454
if let ExprCall(ref caller, ref args) = ex.node {
5555
if args.len() != decl.inputs.len() {

0 commit comments

Comments
 (0)