Skip to content

Commit 406dace

Browse files
committed
Inline and remove early_lint_node.
It has a single call site.
1 parent a9b02af commit 406dace

File tree

1 file changed

+12
-35
lines changed

1 file changed

+12
-35
lines changed

compiler/rustc_lint/src/early.rs

+12-35
Original file line numberDiff line numberDiff line change
@@ -363,30 +363,6 @@ impl<'a> EarlyCheckNode<'a> for (ast::NodeId, &'a [ast::Attribute], &'a [P<ast::
363363
}
364364
}
365365

366-
fn early_lint_node<'a>(
367-
sess: &Session,
368-
warn_about_weird_lints: bool,
369-
lint_store: &LintStore,
370-
registered_tools: &RegisteredTools,
371-
buffered: LintBuffer,
372-
pass: impl EarlyLintPass,
373-
check_node: impl EarlyCheckNode<'a>,
374-
) -> LintBuffer {
375-
let mut cx = EarlyContextAndPass {
376-
context: EarlyContext::new(
377-
sess,
378-
warn_about_weird_lints,
379-
lint_store,
380-
registered_tools,
381-
buffered,
382-
),
383-
pass,
384-
};
385-
386-
cx.with_lint_attrs(check_node.id(), check_node.attrs(), |cx| check_node.check(cx));
387-
cx.context.buffered
388-
}
389-
390366
pub fn check_ast_node<'a>(
391367
sess: &Session,
392368
pre_expansion: bool,
@@ -401,21 +377,22 @@ pub fn check_ast_node<'a>(
401377
let mut passes: Vec<_> = passes.iter().map(|p| (p)()).collect();
402378
passes.push(Box::new(builtin_lints));
403379

404-
let mut buffered = lint_buffer.unwrap_or_default();
405-
buffered = early_lint_node(
406-
sess,
407-
!pre_expansion,
408-
lint_store,
409-
registered_tools,
410-
buffered,
411-
EarlyLintPassObjects { lints: &mut passes[..] },
412-
check_node,
413-
);
380+
let mut cx = EarlyContextAndPass {
381+
context: EarlyContext::new(
382+
sess,
383+
!pre_expansion,
384+
lint_store,
385+
registered_tools,
386+
lint_buffer.unwrap_or_default(),
387+
),
388+
pass: EarlyLintPassObjects { lints: &mut passes[..] },
389+
};
390+
cx.with_lint_attrs(check_node.id(), check_node.attrs(), |cx| check_node.check(cx));
414391

415392
// All of the buffered lints should have been emitted at this point.
416393
// If not, that means that we somehow buffered a lint for a node id
417394
// that was not lint-checked (perhaps it doesn't exist?). This is a bug.
418-
for (id, lints) in buffered.map {
395+
for (id, lints) in cx.context.buffered.map {
419396
for early_lint in lints {
420397
sess.delay_span_bug(
421398
early_lint.span,

0 commit comments

Comments
 (0)