1
Fork 0

delete whitelist and add checks to check_item() for missing_docs

add test and bless
This commit is contained in:
James Dietz 2023-05-03 13:37:37 -04:00
parent 31a4f2da57
commit fd005b06bb
3 changed files with 39 additions and 49 deletions

View file

@ -547,32 +547,13 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
}
fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) {
match it.kind {
hir::ItemKind::Trait(..) => {
// Issue #11592: traits are always considered exported, even when private.
if cx.tcx.visibility(it.owner_id)
== ty::Visibility::Restricted(
cx.tcx.parent_module_from_def_id(it.owner_id.def_id).to_def_id(),
)
{
return;
}
}
hir::ItemKind::TyAlias(..)
| hir::ItemKind::Fn(..)
| hir::ItemKind::Macro(..)
| hir::ItemKind::Mod(..)
| hir::ItemKind::Enum(..)
| hir::ItemKind::Struct(..)
| hir::ItemKind::Union(..)
| hir::ItemKind::Const(..)
| hir::ItemKind::Static(..) => {}
_ => return,
};
// Previously the Impl and Use types have been excluded from missing docs,
// so we will continue to exclude them for compatibility
if let hir::ItemKind::Impl(..) | hir::ItemKind::Use(..) = it.kind {
return;
}
let (article, desc) = cx.tcx.article_and_description(it.owner_id.to_def_id());
self.check_missing_docs_attrs(cx, it.owner_id.def_id, article, desc);
}