-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #11130 - Muscraft:use-ready-macro, r=Eh2406
switch to `std::task::ready!()` where possible In Rust 1.64.0, [`std::task::ready`](https://doc.rust-lang.org/stable/std/task/macro.ready.html) was [stabilized](https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#stabilized-apis). Using `ready!()` can make what is happening clearer in the code as it expands to roughly: ```rust let num = match fut.poll(cx) { Poll::Ready(t) => t, Poll::Pending => return Poll::Pending, }; ``` This PR replaces places using `Poll::Pending => return Poll::Pending` with `ready!()` where appropriate. I was unsure about how useful the new macro would be in one place in [`cargo/registry/index.rs`](https://github.com/rust-lang/cargo/blob/247ca7fd04e5c7cc383bcac7d72316e98fbea2bc/src/cargo/sources/registry/index.rs#L425-L429), so I left it out and will add it in if needed. Close #11128 r? `@Eh2406`
- Loading branch information
Showing
4 changed files
with
44 additions
and
76 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
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