diff --git a/tracing-attributes/src/lib.rs b/tracing-attributes/src/lib.rs index f02ec21a3c..f4f3a4f320 100644 --- a/tracing-attributes/src/lib.rs +++ b/tracing-attributes/src/lib.rs @@ -532,7 +532,7 @@ fn gen_block( ) }; - return quote_spanned!(block.span()=> + return quote!( if tracing::level_enabled!(#level) { let __tracing_attr_span = #span; tracing::Instrument::instrument( @@ -546,7 +546,7 @@ fn gen_block( ); } - let span = quote_spanned!(block.span()=> + let span = quote!( // These variables are left uninitialized and initialized only // if the tracing level is statically enabled at this point. // While the tracing level is also checked at span creation @@ -580,7 +580,7 @@ fn gen_block( ); } - quote_spanned!(block.span()=> + quote_spanned!(block.span() => // Because `quote` produces a stream of tokens _without_ whitespace, the // `if` and the block will appear directly next to each other. This // generates a clippy lint about suspicious `if/else` formatting.