Closed
Description
rustc
now warns about unused macros. With the following code:
macro_rules! used {
() => {};
}
macro_rules! unused { // <- This should be cleaned up.
() => {};
}
fn main() {
used!();
}
we get the warning:
warning: unused macro definition
--> src/main.rs:5:1
|
5 | / macro_rules! unused {
6 | | () => {};
7 | | }
| |_^
|
= note: `#[warn(unused_macros)]` on by default
This is really helpful while cleaning up a large meta-programming mess.
However, it does not warn about unused macro arms, so the following:
macro_rules! used_macro {
(used_arm) => {};
(unused_arm) => {}; // <-- This should be cleaned up.
}
fn main() {
used_macro!(used_arm);
}
yields no warning yet.
Following #34938, I open this issue for discussing this feature. Is this something desirable to have rustc
warn about unused macro arms?