1
Fork 0

Do not pass hir::Crate to lints.

This commit is contained in:
Camille GILLOT 2021-09-12 11:58:27 +02:00
parent abc57f63ad
commit faa7d4221b
17 changed files with 32 additions and 33 deletions

View file

@ -584,7 +584,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
self.doc_hidden_stack.pop().expect("empty doc_hidden_stack");
}
fn check_crate(&mut self, cx: &LateContext<'_>, _: &hir::Crate<'_>) {
fn check_crate(&mut self, cx: &LateContext<'_>) {
self.check_missing_docs_attrs(
cx,
CRATE_DEF_ID,

View file

@ -430,8 +430,6 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx>>(
fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T) {
let access_levels = &tcx.privacy_access_levels(());
let krate = tcx.hir().krate();
let context = LateContext {
tcx,
enclosing_body: None,
@ -450,10 +448,10 @@ fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T)
cx.with_lint_attrs(hir::CRATE_HIR_ID, |cx| {
// since the root module isn't visited as an item (because it isn't an
// item), warn for it here.
lint_callback!(cx, check_crate, krate);
lint_callback!(cx, check_crate,);
tcx.hir().walk_toplevel_module(cx);
tcx.hir().walk_attributes(cx);
lint_callback!(cx, check_crate_post, krate);
lint_callback!(cx, check_crate_post,);
})
}

View file

@ -16,8 +16,8 @@ macro_rules! late_lint_methods {
fn check_body(a: &$hir hir::Body<$hir>);
fn check_body_post(a: &$hir hir::Body<$hir>);
fn check_name(a: Span, b: Symbol);
fn check_crate(a: &$hir hir::Crate<$hir>);
fn check_crate_post(a: &$hir hir::Crate<$hir>);
fn check_crate();
fn check_crate_post();
fn check_mod(a: &$hir hir::Mod<$hir>, b: Span, c: hir::HirId);
fn check_mod_post(a: &$hir hir::Mod<$hir>, b: Span, c: hir::HirId);
fn check_foreign_item(a: &$hir hir::ForeignItem<$hir>);