Skip to content

Commit

Permalink
Allow the unused_macro_rules lint for now
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
est31 committed May 14, 2022
1 parent c6499fd commit 015e2ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// #[warn(unused_macro_rules)]
/// macro_rules! unused_empty {
/// (hello) => { println!("Hello, world!") }; // This rule is unused
/// () => { println!("empty") }; // This rule is used
Expand All @@ -814,7 +815,7 @@ declare_lint! {
///
/// [`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"
}

Expand Down

0 comments on commit 015e2ae

Please sign in to comment.