From 4711c3078a653ab7242ed5b9e954ae7ad03646f3 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 6 Jun 2023 11:50:04 +0200 Subject: [PATCH] Prevent emitting `missing_docs` for `pub extern crate` --- compiler/rustc_lint/src/builtin.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 213e8db66a0..8c0956a618d 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -548,8 +548,12 @@ fn check_crate(&mut self, cx: &LateContext<'_>) { fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) { // 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 { + // so we will continue to exclude them for compatibility. + // + // The documentation on `ExternCrate` is not used at the moment so no need to warn for it. + if let hir::ItemKind::Impl(..) | hir::ItemKind::Use(..) | hir::ItemKind::ExternCrate(_) = + it.kind + { return; }