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:
Abhishek 2022-11-05 01:08:28 +05:30 committed by Eliza Weisman
parent 5ff8a410e1
commit 6bd3d40d2b

View File

@ -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");