Skip to content

Commit be45f10

Browse files
committed
Inline and remove {enter,exit}_attrs functions.
They each have a single call site.
1 parent c9e9725 commit be45f10

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

compiler/rustc_lint/src/early.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,12 @@ impl<'a, T: EarlyLintPass> EarlyContextAndPass<'a, T> {
6363
let push = self.context.builder.push(attrs, is_crate_node, None);
6464

6565
self.check_id(id);
66-
self.enter_attrs(attrs);
67-
f(self);
68-
self.exit_attrs(attrs);
69-
self.context.builder.pop(push);
70-
}
71-
72-
fn enter_attrs(&mut self, attrs: &'a [ast::Attribute]) {
7366
debug!("early context: enter_attrs({:?})", attrs);
7467
run_early_pass!(self, enter_lint_attrs, attrs);
75-
}
76-
77-
fn exit_attrs(&mut self, attrs: &'a [ast::Attribute]) {
68+
f(self);
7869
debug!("early context: exit_attrs({:?})", attrs);
7970
run_early_pass!(self, exit_lint_attrs, attrs);
71+
self.context.builder.pop(push);
8072
}
8173
}
8274

compiler/rustc_lint/src/late.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> {
5959
let attrs = self.context.tcx.hir().attrs(id);
6060
let prev = self.context.last_node_with_lint_attrs;
6161
self.context.last_node_with_lint_attrs = id;
62-
self.enter_attrs(attrs);
62+
debug!("late context: enter_attrs({:?})", attrs);
63+
lint_callback!(self, enter_lint_attrs, attrs);
6364
f(self);
64-
self.exit_attrs(attrs);
65+
debug!("late context: exit_attrs({:?})", attrs);
66+
lint_callback!(self, exit_lint_attrs, attrs);
6567
self.context.last_node_with_lint_attrs = prev;
6668
}
6769

@@ -81,16 +83,6 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> {
8183
hir_visit::walk_mod(self, m, n);
8284
lint_callback!(self, check_mod_post, m, s, n);
8385
}
84-
85-
fn enter_attrs(&mut self, attrs: &'tcx [ast::Attribute]) {
86-
debug!("late context: enter_attrs({:?})", attrs);
87-
lint_callback!(self, enter_lint_attrs, attrs);
88-
}
89-
90-
fn exit_attrs(&mut self, attrs: &'tcx [ast::Attribute]) {
91-
debug!("late context: exit_attrs({:?})", attrs);
92-
lint_callback!(self, exit_lint_attrs, attrs);
93-
}
9486
}
9587

9688
impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPass<'tcx, T> {

0 commit comments

Comments
 (0)