-
Notifications
You must be signed in to change notification settings - Fork 817
Description
Bug Report
Version
(Version number from Rust playground as of creating this issue)
tracing-attributes
: 0.1.23
Platform
I've noticed this on both Linux (CI builds) and MacOS (development machines).
Crates
tracing-attributes
: 0.1.23
Description
Sample code: (Rust playground)
#![warn(clippy::panic_in_result_fn)]
#[tracing_attributes::instrument]
fn main() -> Result<(), String> {
Ok(())
}
The fake return edge added in #2270 triggers the clippy::panic_in_result_fn
lint for the above sample code (and async functions which return Result
). The only way of ignoring the lint is to annotate the entire function with #[allow(clippy::panic_in_result_fn)]
, which I'd like to avoid as it allows calling panicking code elsewhere in the function.
I tried to allow the lint only for the fake return edge block on a fork of tracing
but didn't succeed. Let me know if I should open an issue on the clippy repository for ignoring this lint on macro generated code (this might also be related to rust-lang/rust-clippy#407 in that case).
I'd be happy to open a PR to fix this, I'm just not sure how this can be solved though, and whether a change must be made in tracing-attributes
or in the clippy codebase.