Open
Description
Summary
disallowed_macros
has several false negatives. See reproducer.
Lint Name
disallowed_macros
Reproducer
With clippy.toml
:
disallowed-macros = [ "x::m" ]
And a command line like:
clippy-driver --edition=2021 -Dclippy::disallowed_macros x.rs
This works (similar to an existing test in Clippy):
macro_rules! m (
($t:tt) => (1)
);
fn main() {
let _ = m!(42);
}
However, this does not:
macro_rules! m (
($t:tt) => ($t)
);
fn main() {
let _ = m!(42);
}
Nor:
macro_rules! m (
($t:tt) => ($t + $t)
);
fn main() {
let _ = m!(42);
}
In addition, empty expansions also do not work -- this may be due to the lint not having a pre-expansion part, but still, it would be nice to handle:
macro_rules! m (
($t:tt) => ()
);
fn main() {
m!(42);
}
Version
rustc 1.72.0 (5680fa18f 2023-08-23)
rustc 1.74.0-nightly (84a9f4c6e 2023-08-29)