Skip to content

Commit

Permalink
Suppress clippy divergence warning
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Aug 8, 2022
1 parent 9aea0e5 commit 33354fd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tracing-attributes/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ pub(crate) fn gen_function<'a, B: ToTokens + 'a>(
// Install a fake return statement as the first thing in the function
// body, so that we eagerly infer that the return type is what we
// declared in the async fn signature.
// The `#[allow(unreachable_code)]` is given because the return
// statement is unreachable, but does affect inference.
// The `#[allow(..)]` is given because the return statement is
// 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_type.span()=>
#[allow(unreachable_code)]
#[allow(unreachable_code, clippy::diverging_sub_expression)]
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 33354fd

Please sign in to comment.