Skip to content

Commit 357aee9

Browse files
committed
Inline and remove late_lint_pass_crate.
It has a single call site.
1 parent 0e4f55d commit 357aee9

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

compiler/rustc_lint/src/late.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ macro_rules! late_lint_pass_impl {
326326

327327
crate::late_lint_methods!(late_lint_pass_impl, [], ['tcx]);
328328

329-
pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
329+
pub(super) fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
330330
tcx: TyCtxt<'tcx>,
331331
module_def_id: LocalDefId,
332332
builtin_lints: T,
@@ -361,26 +361,29 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
361361
}
362362
}
363363

364-
fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T) {
365-
let effective_visibilities = &tcx.effective_visibilities(());
366-
364+
fn late_lint_crate<'tcx, T: LateLintPass<'tcx> + 'tcx>(tcx: TyCtxt<'tcx>, builtin_lints: T) {
367365
let context = LateContext {
368366
tcx,
369367
enclosing_body: None,
370368
cached_typeck_results: Cell::new(None),
371369
param_env: ty::ParamEnv::empty(),
372-
effective_visibilities,
370+
effective_visibilities: &tcx.effective_visibilities(()),
373371
lint_store: unerased_lint_store(tcx),
374372
last_node_with_lint_attrs: hir::CRATE_HIR_ID,
375373
generics: None,
376374
only_module: false,
377375
};
378376

377+
let mut passes =
378+
unerased_lint_store(tcx).late_passes.iter().map(|p| (p)(tcx)).collect::<Vec<_>>();
379+
passes.push(Box::new(builtin_lints));
380+
let pass = LateLintPassObjects { lints: &mut passes[..] };
381+
379382
let mut cx = LateContextAndPass { context, pass };
380383

381384
// Visit the whole crate.
382385
cx.with_lint_attrs(hir::CRATE_HIR_ID, |cx| {
383-
// since the root module isn't visited as an item (because it isn't an
386+
// Since the root module isn't visited as an item (because it isn't an
384387
// item), warn for it here.
385388
lint_callback!(cx, check_crate,);
386389
tcx.hir().walk_toplevel_module(cx);
@@ -389,14 +392,6 @@ fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T)
389392
})
390393
}
391394

392-
fn late_lint_crate<'tcx, T: LateLintPass<'tcx> + 'tcx>(tcx: TyCtxt<'tcx>, builtin_lints: T) {
393-
let mut passes =
394-
unerased_lint_store(tcx).late_passes.iter().map(|p| (p)(tcx)).collect::<Vec<_>>();
395-
passes.push(Box::new(builtin_lints));
396-
397-
late_lint_pass_crate(tcx, LateLintPassObjects { lints: &mut passes[..] });
398-
}
399-
400395
/// Performs lint checking on a crate.
401396
pub fn check_crate<'tcx, T: LateLintPass<'tcx> + 'tcx>(
402397
tcx: TyCtxt<'tcx>,

0 commit comments

Comments
 (0)