mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
refactor: use pin!
macro from std (#18110)
<!-- Before submitting a PR, please read http://deno.land/manual/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. --> This commit replaces `pin_mut!` macro with `pin!` macro that has been provided from std since Rust 1.68.0. With the std version we can not only expect its stability but also pass an expression (rather than identifier) as an argument to the macro.
This commit is contained in:
parent
c7a5f928d3
commit
e3408067cc
2 changed files with 10 additions and 14 deletions
|
@ -14,7 +14,6 @@ use deno_core::futures::future::Pending;
|
|||
use deno_core::futures::future::RemoteHandle;
|
||||
use deno_core::futures::future::Shared;
|
||||
use deno_core::futures::never::Never;
|
||||
use deno_core::futures::pin_mut;
|
||||
use deno_core::futures::ready;
|
||||
use deno_core::futures::stream::Peekable;
|
||||
use deno_core::futures::FutureExt;
|
||||
|
@ -62,6 +61,7 @@ use std::io;
|
|||
use std::io::Write;
|
||||
use std::mem::replace;
|
||||
use std::mem::take;
|
||||
use std::pin::pin;
|
||||
use std::pin::Pin;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
@ -156,8 +156,8 @@ impl HttpConnResource {
|
|||
|
||||
// A local task that polls the hyper connection future to completion.
|
||||
let task_fut = async move {
|
||||
pin_mut!(shutdown_fut);
|
||||
pin_mut!(conn_fut);
|
||||
let conn_fut = pin!(conn_fut);
|
||||
let shutdown_fut = pin!(shutdown_fut);
|
||||
let result = match select(conn_fut, shutdown_fut).await {
|
||||
Either::Left((result, _)) => result,
|
||||
Either::Right((_, mut conn_fut)) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue