-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Make redundant_async_block a more complete late pass #10554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
r? @Jarcho (rustbot has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the wait. Just one suggested improvement and then a couple of nits.
44caf1b
to
66b9d30
Compare
Just needs an |
This lets us detect more complex situations: `async { x.await }` is simplified into `x` if: - `x` is an expression without side-effect - or `x` is an async block itself In both cases, no part of the `async` expression can be part of a macro expansion.
66b9d30
to
2891d8f
Compare
Thanks for fixing the lint. @bors r+ |
Make redundant_async_block a more complete late pass This lets us detect more complex situations: `async { x.await }` is simplified into `x` if: - `x` is an expression without side-effect - or `x` is an `async` block itself In both cases, no part of the `async` expression can be part of a macro expansion. Fixes #10509. Fixes #10525. changelog: [`redundant_async_block`] Do not lint expressions with side effects.
💔 Test failed - checks-action_test |
@bors retry |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
1 similar comment
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This reverts commit 2ca919d5593244ee9ff97cc0805de16c04e3351a. Reason for revert: The lint was fixed by rust-lang/rust-clippy#10554 Fixed: 123778 Original change's description: > [rust] Add #![allow(clippy::redundant_async_block)] > > This CL adds attributes to allow the new redundant_async_block clippy > lint to unblock the toolchain roll. It only adds it to affected crates. > It also adds #![allow(unknown_lints)] which can be removed as soon as > the toolchain rolls. > > We are not fixing the lints right now because there are false positives: > > rust-lang/rust-clippy#10482 > rust-lang/rust-clippy#10509 > > Once those are resolved, we can remove these attributes and fix the > occurrences or add more narrowly scoped attributes. > > Test: fx clippy --all --raw # tested with old and new toolchain > Bug: 123528 > Bug: 123778 > Change-Id: If874cae8621b9469b9fde0cb6220250710c8848c > Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/820449 > Reviewed-by: Dan Johnson <[email protected]> > Reviewed-by: Tyler Mandry <[email protected]> > Commit-Queue: Mitchell Kember <[email protected]> Bug: 123528 Bug: 123778 Change-Id: I3385740f5b8d5205919a5c2a41c1eb584791fa88 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/834979 Reviewed-by: Mitchell Kember <[email protected]> Reviewed-by: Tyler Mandry <[email protected]> Reviewed-by: Dan Johnson <[email protected]> Commit-Queue: Joseph Ryan <[email protected]>
This reverts commit 4531398. Reason for revert: The lint was fixed by rust-lang/rust-clippy#10554 Fixed: 123778 Original change's description: > [rust] Add #![allow(clippy::redundant_async_block)] > > This CL adds attributes to allow the new redundant_async_block clippy > lint to unblock the toolchain roll. It only adds it to affected crates. > It also adds #![allow(unknown_lints)] which can be removed as soon as > the toolchain rolls. > > We are not fixing the lints right now because there are false positives: > > rust-lang/rust-clippy#10482 > rust-lang/rust-clippy#10509 > > Once those are resolved, we can remove these attributes and fix the > occurrences or add more narrowly scoped attributes. > > Test: fx clippy --all --raw # tested with old and new toolchain > Bug: 123528 > Bug: 123778 > Change-Id: If874cae8621b9469b9fde0cb6220250710c8848c > Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/820449 > Reviewed-by: Dan Johnson <[email protected]> > Reviewed-by: Tyler Mandry <[email protected]> > Commit-Queue: Mitchell Kember <[email protected]> Bug: 123528 Bug: 123778 Change-Id: I3385740f5b8d5205919a5c2a41c1eb584791fa88 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/834979 Reviewed-by: Mitchell Kember <[email protected]> Reviewed-by: Tyler Mandry <[email protected]> Reviewed-by: Dan Johnson <[email protected]> Commit-Queue: Joseph Ryan <[email protected]>
This lets us detect more complex situations:
async { x.await }
is simplified intox
if:x
is an expression without side-effectx
is anasync
block itselfIn both cases, no part of the
async
expression can be part of a macro expansion.Fixes #10509.
Fixes #10525.
changelog: [
redundant_async_block
] Do not lint expressions with side effects.