Skip to content

Commit d3285d1

Browse files
committed
Use std::pin::pin instead of futures_lite::pin
1 parent d21f25e commit d3285d1

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/driver.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
use std::cell::{Cell, RefCell};
22
use std::future::Future;
3+
use std::pin::pin;
34
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
45
use std::sync::{Arc, OnceLock};
5-
use std::task::Waker;
6-
use std::task::{Context, Poll};
6+
use std::task::{Context, Poll, Waker};
77
use std::thread;
88
use std::time::{Duration, Instant};
99

10-
use futures_lite::pin;
1110
use parking::Parker;
1211

1312
use crate::reactor::Reactor;
@@ -196,7 +195,7 @@ pub fn block_on<T>(future: impl Future<Output = T>) -> T {
196195
}
197196
};
198197

199-
pin!(future);
198+
let mut future = pin!(future);
200199

201200
let cx = &mut Context::from_waker(waker);
202201

src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
use std::future::Future;
6565
use std::io::{self, IoSlice, IoSliceMut, Read, Write};
6666
use std::net::{SocketAddr, TcpListener, TcpStream, UdpSocket};
67-
use std::pin::Pin;
67+
use std::pin::{pin, Pin};
6868
use std::sync::Arc;
6969
use std::task::{ready, Context, Poll, Waker};
7070
use std::time::{Duration, Instant};
@@ -80,8 +80,8 @@ use std::{
8080
use std::os::windows::io::{AsRawSocket, AsSocket, BorrowedSocket, OwnedSocket, RawSocket};
8181

8282
use futures_io::{AsyncRead, AsyncWrite};
83+
use futures_lite::future;
8384
use futures_lite::stream::{self, Stream};
84-
use futures_lite::{future, pin};
8585

8686
use rustix::io as rio;
8787
use rustix::net as rn;
@@ -1472,13 +1472,14 @@ impl Async<TcpListener> {
14721472
///
14731473
/// ```no_run
14741474
/// use async_io::Async;
1475-
/// use futures_lite::{pin, stream::StreamExt};
1475+
/// use futures_lite::{stream::StreamExt};
14761476
/// use std::net::TcpListener;
1477+
/// use std::pin::pin;
14771478
///
14781479
/// # futures_lite::future::block_on(async {
14791480
/// let listener = Async::<TcpListener>::bind(([127, 0, 0, 1], 8000))?;
14801481
/// let incoming = listener.incoming();
1481-
/// pin!(incoming);
1482+
/// let mut incoming = pin!(incoming);
14821483
///
14831484
/// while let Some(stream) = incoming.next().await {
14841485
/// let stream = stream?;
@@ -1808,13 +1809,14 @@ impl Async<UnixListener> {
18081809
///
18091810
/// ```no_run
18101811
/// use async_io::Async;
1811-
/// use futures_lite::{pin, stream::StreamExt};
1812+
/// use futures_lite::stream::StreamExt;
18121813
/// use std::os::unix::net::UnixListener;
1814+
/// use std::pin::pin;
18131815
///
18141816
/// # futures_lite::future::block_on(async {
18151817
/// let listener = Async::<UnixListener>::bind("/tmp/socket")?;
18161818
/// let incoming = listener.incoming();
1817-
/// pin!(incoming);
1819+
/// let mut incoming = pin!(incoming);
18181820
///
18191821
/// while let Some(stream) = incoming.next().await {
18201822
/// let stream = stream?;
@@ -2055,7 +2057,7 @@ impl TryFrom<std::os::unix::net::UnixDatagram> for Async<std::os::unix::net::Uni
20552057
/// Polls a future once, waits for a wakeup, and then optimistically assumes the future is ready.
20562058
async fn optimistic(fut: impl Future<Output = io::Result<()>>) -> io::Result<()> {
20572059
let mut polled = false;
2058-
pin!(fut);
2060+
let mut fut = pin!(fut);
20592061

20602062
future::poll_fn(|cx| {
20612063
if !polled {

0 commit comments

Comments
 (0)