You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems the panic_in_result_fn lint cannot be allowed for a single statement or block of code, and must be allowed for the entire function. I'd like to know if this is intentional behavior, or is there a possibility of having it ignored for a specific block of code?
I noticed this after a "fake return edge" was added to the instrument macro in the tracing-attributes crate (tokio-rs/tracing#2270) which triggers the panic_in_result_fn clippy lint in our codebase. I tried to allow the lint for only that block of code, but it seems that the lint can only be allowed for the entire function, which I'd prefer not to do, as it would allow calling panicking code elsewhere in the function. (I'd opened tokio-rs/tracing#2498 on the tracing repo, was suggested that I open an issue here.)
I'm not sure if this specific scenario should be ignored by clippy, as it is triggered by code generated by an external attribute macro.
Reproducer
I tried these code snippets (similar to the code found in tracing):
Summary
It seems the
panic_in_result_fn
lint cannot be allowed for a single statement or block of code, and must be allowed for the entire function. I'd like to know if this is intentional behavior, or is there a possibility of having it ignored for a specific block of code?I noticed this after a "fake return edge" was added to the
instrument
macro in thetracing-attributes
crate (tokio-rs/tracing#2270) which triggers thepanic_in_result_fn
clippy lint in our codebase. I tried to allow the lint for only that block of code, but it seems that the lint can only be allowed for the entire function, which I'd prefer not to do, as it would allow calling panicking code elsewhere in the function. (I'd opened tokio-rs/tracing#2498 on thetracing
repo, was suggested that I open an issue here.)I'm not sure if this specific scenario should be ignored by clippy, as it is triggered by code generated by an external attribute macro.
Reproducer
I tried these code snippets (similar to the code found in
tracing
):I expected that
clippy
would ignore the lint for the specific statement and/orif
block.Instead,
clippy
still emits thepanic_in_result_fn
warning.The only way I'm able to allow the lint is to allow it for the entire function:
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: