mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-09-28 13:31:52 +00:00
attributes: allow clippy::unreachable
warning (#2356)
## Motivation PR #2270 added an unreachable branch with an explicit return value to `#[instrument]` in `async fn`s in order to fix type inference issues. That PR added the appropriate `#[allow]` attribute for the Rust compiler's unreachable code linting, but not Clippy's, so a Clippy warning is still emitted. See: https://github.com/tokio-rs/tracing/pull/2270#issuecomment-1282881008 ## Solution Adding the clippy lint warning as discussed here: https://github.com/tokio-rs/tracing/pull/2270#issuecomment-1282887973
This commit is contained in:
parent
5ff8a410e1
commit
6bd3d40d2b
@ -64,7 +64,7 @@ pub(crate) fn gen_function<'a, B: ToTokens + 'a>(
|
||||
// unreachable, but does affect inference, so it needs to be written
|
||||
// exactly that way for it to do its magic.
|
||||
let fake_return_edge = quote_spanned! {return_span=>
|
||||
#[allow(unreachable_code, clippy::diverging_sub_expression, clippy::let_unit_value)]
|
||||
#[allow(unreachable_code, clippy::diverging_sub_expression, clippy::let_unit_value, clippy::unreachable)]
|
||||
if false {
|
||||
let __tracing_attr_fake_return: #return_type =
|
||||
unreachable!("this is just for type inference, and is unreachable code");
|
||||
|
Loading…
x
Reference in New Issue
Block a user