diff options
| author | Oli Scherer <github333195615777966@oli-obk.de> | 2025-04-11 09:52:47 +0000 |
|---|---|---|
| committer | Oli Scherer <github333195615777966@oli-obk.de> | 2025-04-11 10:04:27 +0000 |
| commit | 33a6820c2f3087e1fc5b69a2367b6d3528b767b9 (patch) | |
| tree | 3c4e1168bbdc240adb5185b8d5d8ccfca2f66276 /compiler/rustc_resolve/src/macros.rs | |
| parent | f5c60f616f13e1267c1eb4df94a5a9c23c18b997 (diff) | |
| download | rust-33a6820c2f3087e1fc5b69a2367b6d3528b767b9.tar.gz rust-33a6820c2f3087e1fc5b69a2367b6d3528b767b9.zip | |
Avoid storing the `LocalDefId` twice
Diffstat (limited to 'compiler/rustc_resolve/src/macros.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/macros.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index 47e5d366107..aee6acd7725 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -336,14 +336,12 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> { ident.span, BuiltinLintDiag::UnusedMacroDefinition(ident.name), ); + // Do not report unused individual rules if the entire macro is unused + self.unused_macro_rules.swap_remove(&node_id); } for (&node_id, unused_arms) in self.unused_macro_rules.iter() { - for (&arm_i, &(ident, rule_span, def_id)) in unused_arms.to_sorted_stable_ord() { - if self.unused_macros.contains_key(&def_id) { - // We already lint the entire macro as unused - continue; - } + for (&arm_i, &(ident, rule_span)) in unused_arms.to_sorted_stable_ord() { self.lint_buffer.buffer_lint( UNUSED_MACRO_RULES, node_id, |
