Inline and remove late_lint_mod_pass
.
It has a single call site.
This commit is contained in:
parent
890c5ead20
commit
0e4f55d63f
1 changed files with 8 additions and 17 deletions
|
@ -326,25 +326,28 @@ macro_rules! late_lint_pass_impl {
|
||||||
|
|
||||||
crate::late_lint_methods!(late_lint_pass_impl, [], ['tcx]);
|
crate::late_lint_methods!(late_lint_pass_impl, [], ['tcx]);
|
||||||
|
|
||||||
fn late_lint_mod_pass<'tcx, T: LateLintPass<'tcx>>(
|
pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
module_def_id: LocalDefId,
|
module_def_id: LocalDefId,
|
||||||
pass: T,
|
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: tcx.hir().local_def_id_to_hir_id(module_def_id),
|
last_node_with_lint_attrs: tcx.hir().local_def_id_to_hir_id(module_def_id),
|
||||||
generics: None,
|
generics: None,
|
||||||
only_module: true,
|
only_module: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut passes: Vec<_> =
|
||||||
|
unerased_lint_store(tcx).late_module_passes.iter().map(|pass| (pass)(tcx)).collect();
|
||||||
|
passes.push(Box::new(builtin_lints));
|
||||||
|
let pass = LateLintPassObjects { lints: &mut passes[..] };
|
||||||
|
|
||||||
let mut cx = LateContextAndPass { context, pass };
|
let mut cx = LateContextAndPass { context, pass };
|
||||||
|
|
||||||
let (module, _span, hir_id) = tcx.hir().get_module(module_def_id);
|
let (module, _span, hir_id) = tcx.hir().get_module(module_def_id);
|
||||||
|
@ -358,18 +361,6 @@ fn late_lint_mod_pass<'tcx, T: LateLintPass<'tcx>>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
|
|
||||||
tcx: TyCtxt<'tcx>,
|
|
||||||
module_def_id: LocalDefId,
|
|
||||||
builtin_lints: T,
|
|
||||||
) {
|
|
||||||
let mut passes: Vec<_> =
|
|
||||||
unerased_lint_store(tcx).late_module_passes.iter().map(|pass| (pass)(tcx)).collect();
|
|
||||||
passes.push(Box::new(builtin_lints));
|
|
||||||
|
|
||||||
late_lint_mod_pass(tcx, module_def_id, LateLintPassObjects { lints: &mut passes[..] });
|
|
||||||
}
|
|
||||||
|
|
||||||
fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T) {
|
fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T) {
|
||||||
let effective_visibilities = &tcx.effective_visibilities(());
|
let effective_visibilities = &tcx.effective_visibilities(());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue