Inline and remove late_lint_pass_crate
.
It has a single call site.
This commit is contained in:
parent
0e4f55d63f
commit
357aee9320
1 changed files with 9 additions and 14 deletions
|
@ -326,7 +326,7 @@ macro_rules! late_lint_pass_impl {
|
||||||
|
|
||||||
crate::late_lint_methods!(late_lint_pass_impl, [], ['tcx]);
|
crate::late_lint_methods!(late_lint_pass_impl, [], ['tcx]);
|
||||||
|
|
||||||
pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
|
pub(super) fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
module_def_id: LocalDefId,
|
module_def_id: LocalDefId,
|
||||||
builtin_lints: T,
|
builtin_lints: T,
|
||||||
|
@ -361,26 +361,29 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T) {
|
fn late_lint_crate<'tcx, T: LateLintPass<'tcx> + 'tcx>(tcx: TyCtxt<'tcx>, builtin_lints: T) {
|
||||||
let effective_visibilities = &tcx.effective_visibilities(());
|
|
||||||
|
|
||||||
let context = LateContext {
|
let context = LateContext {
|
||||||
tcx,
|
tcx,
|
||||||
enclosing_body: None,
|
enclosing_body: None,
|
||||||
cached_typeck_results: Cell::new(None),
|
cached_typeck_results: Cell::new(None),
|
||||||
param_env: ty::ParamEnv::empty(),
|
param_env: ty::ParamEnv::empty(),
|
||||||
effective_visibilities,
|
effective_visibilities: &tcx.effective_visibilities(()),
|
||||||
lint_store: unerased_lint_store(tcx),
|
lint_store: unerased_lint_store(tcx),
|
||||||
last_node_with_lint_attrs: hir::CRATE_HIR_ID,
|
last_node_with_lint_attrs: hir::CRATE_HIR_ID,
|
||||||
generics: None,
|
generics: None,
|
||||||
only_module: false,
|
only_module: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut passes =
|
||||||
|
unerased_lint_store(tcx).late_passes.iter().map(|p| (p)(tcx)).collect::<Vec<_>>();
|
||||||
|
passes.push(Box::new(builtin_lints));
|
||||||
|
let pass = LateLintPassObjects { lints: &mut passes[..] };
|
||||||
|
|
||||||
let mut cx = LateContextAndPass { context, pass };
|
let mut cx = LateContextAndPass { context, pass };
|
||||||
|
|
||||||
// Visit the whole crate.
|
// Visit the whole crate.
|
||||||
cx.with_lint_attrs(hir::CRATE_HIR_ID, |cx| {
|
cx.with_lint_attrs(hir::CRATE_HIR_ID, |cx| {
|
||||||
// since the root module isn't visited as an item (because it isn't an
|
// Since the root module isn't visited as an item (because it isn't an
|
||||||
// item), warn for it here.
|
// item), warn for it here.
|
||||||
lint_callback!(cx, check_crate,);
|
lint_callback!(cx, check_crate,);
|
||||||
tcx.hir().walk_toplevel_module(cx);
|
tcx.hir().walk_toplevel_module(cx);
|
||||||
|
@ -389,14 +392,6 @@ fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn late_lint_crate<'tcx, T: LateLintPass<'tcx> + 'tcx>(tcx: TyCtxt<'tcx>, builtin_lints: T) {
|
|
||||||
let mut passes =
|
|
||||||
unerased_lint_store(tcx).late_passes.iter().map(|p| (p)(tcx)).collect::<Vec<_>>();
|
|
||||||
passes.push(Box::new(builtin_lints));
|
|
||||||
|
|
||||||
late_lint_pass_crate(tcx, LateLintPassObjects { lints: &mut passes[..] });
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Performs lint checking on a crate.
|
/// Performs lint checking on a crate.
|
||||||
pub fn check_crate<'tcx, T: LateLintPass<'tcx> + 'tcx>(
|
pub fn check_crate<'tcx, T: LateLintPass<'tcx> + 'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue