Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
attributes: remove unnecessary quote_spanned! (#1617)
## Motivation Apparently, using `quote_spanned!` can trigger a Clippy bug where the text `else`, even inside a comment, _may_ cause the `suspicious_else_formatting` lint to be triggered incorrectly (see rust-lang/rust-clippy#7760 and rust-lang/rust-clippy#6249). This causes the lint to fire in some cases when the `#[instrument]` attribute is used on `async fn`s. See issue #1613 for details. ## Solution It turns out that some of the uses of `quote_spanned!` in the `tracing-attributes` code generation are not needed. We really only need `quote_spanned!` when actually interpolating the user provided code into a block, not in the `tracing-attributes` code that inserts the generated code for producing the span etc. Replacing some of these `quote_spanned!` uses with the normal `quote!` macro still generates correct location diagnostics for errors in the user code, but fixes the incorrect clippy lint. I've added a few test cases that should reproduce the bug. Fixes #1613 Signed-off-by: Eliza Weisman <[email protected]>
- Loading branch information