-
Notifications
You must be signed in to change notification settings - Fork 729
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
attributes: remove extra braces around
async
blocks (#2090)
## Motivation When using an `async` block (as an alternative to `async fn`, e.g. when implementing a trait), `#[instrument]` adds extra braces around the wrapped `async` block. This causes `rustc` to emit an `unused_braces` lint in some cases (usually for single-line `async` blocks, as far as I can tell). See #1831 for an example. ## Solution Since the `async` block extracted by `AsyncInfo::from_fn` already has braces around its statements, there's no need to wrap it with additional braces. This updates `gen_block` to remove those extra braces when generating the code providing the value of `__tracing_instrument_future`. - [x] add repros for `unused_braces` issue - [x] remove extra braces from async blocks Fixes #1831
- Loading branch information
1 parent
f968517
commit 3d7a18b
Showing
2 changed files
with
21 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters