From 015e2ae76984144a7ece6d8169ff42b6dc7d6870 Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 14 May 2022 03:41:06 +0200 Subject: [PATCH] Allow the unused_macro_rules lint for now This makes the transition easier as e.g. allow directives won't fire the unknown lint warning once it is turned to warn by default in the future. This is especially important compared to other lints in the unused group because the _ prefix trick doesn't exist for macro rules, so allowing is the only option (either of unused_macro_rules, or of the entire unused group, but that is not as informative to readers). Allowing the lint also makes it possible to work on possible heuristics for disabling the macro in specific cases. --- compiler/rustc_lint_defs/src/builtin.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 7ebb1e85cdb..f9429702783 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -790,6 +790,7 @@ /// ### Example /// /// ```rust + /// #[warn(unused_macro_rules)] /// macro_rules! unused_empty { /// (hello) => { println!("Hello, world!") }; // This rule is unused /// () => { println!("empty") }; // This rule is used @@ -814,7 +815,7 @@ /// /// [`macro_export` attribute]: https://doc.rust-lang.org/reference/macros-by-example.html#path-based-scope pub UNUSED_MACRO_RULES, - Warn, + Allow, "detects macro rules that were not used" }