From 4fdf43f23fbd4fb69960c9136dc796d8e64be785 Mon Sep 17 00:00:00 2001 From: Ibraheem Ahmed Date: Thu, 21 Jul 2022 13:06:08 -0400 Subject: [PATCH] `special_module_name`: ignore inline modules --- compiler/rustc_lint/src/builtin.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 961e1e9507b97..e9841b7f07132 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -3299,7 +3299,11 @@ declare_lint_pass!(SpecialModuleName => [SPECIAL_MODULE_NAME]); impl EarlyLintPass for SpecialModuleName { fn check_crate(&mut self, cx: &EarlyContext<'_>, krate: &ast::Crate) { for item in &krate.items { - if let ast::ItemKind::Mod(..) = item.kind { + if let ast::ItemKind::Mod( + _, + ast::ModKind::Unloaded | ast::ModKind::Loaded(_, ast::Inline::No, _), + ) = item.kind + { if item.attrs.iter().any(|a| a.has_name(sym::path)) { continue; }