Skip to content

Commit

Permalink
attributes: allow clippy::unreachable warning (#2356)
Browse files Browse the repository at this point in the history
## 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:
#2270 (comment)

## Solution

Adding the clippy lint warning as discussed here:
#2270 (comment)
  • Loading branch information
Abhicodes-crypto authored and hawkw committed Apr 21, 2023
1 parent 018ded8 commit 099f133
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tracing-attributes/src/expand.rs
Expand Up @@ -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");
Expand Down

0 comments on commit 099f133

Please sign in to comment.