[1.84.0 regression] #[allow(clippy::disallowed_macros)]
does not work on two-argument std::panic
#14017
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
As of 1.84.0, it is not possible to use
#[allow]
or#[expect]
to silenceclippy::disallowed_macros
when invokingstd::panic
with exactly two arguments.Or at least, the straightforward thing does not work, and I haven't found a workaround other than "don't use
std::panic
with two arguments".As far as I can tell, this is specific to
std::panic
and specific to the two-argument case, which seems pretty strange... But I obviously haven't exhaustively tested all macros so maybe that is just a coincidence.Lint Name
disallowed_macros
Reproducer
I tried this code:
With this
clippy.toml
:I saw this happen:
I expected to see this happen: no error.
With
cargo +1.83.0 clippy
it works, withcargo +1.84.0 clippy
it no longer does. (And at least 1.82.0 and 1.81.0 also work; didn't test older than that.)If the
#![expect]
lines are removed, I see six errors with both versions as expected — though 1.84.0 strangely reports the two-argumentstd::panic
one, i.e. the problematic one that can't be silenced, as the very first error, instead of reporting the errors in source code order. Maybe that's somehow related?Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: