-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.
Description
If you declare a variable, and not use it, you get an unused code warning.
The same should be true for macros (that don't have the #[macro_export]
attribute). So if you have a private macro like:
fn main() {
macro_rules! do_something {
($x:expr) => {$x + 20}
}
}
It should give you a warning. Same goes if you use a macro, but not all of its match arms:
fn main() {
macro_rules! do_something {
($x:expr) => {$x + 20};
($i:ident, $x:expr) => {$i = $x + 20};
}
println!("done: {}", do_something!(2));
}
Note that this is no dupe or not even against #24580. That issue is about unused code inside macro expansions, but my issue is about macro use.
By description, this falls under the definition of the dead-code
lint.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.