@@ -48,9 +48,10 @@ use std::os::windows::fs::OpenOptionsExt as _;
4848
4949use async_lock:: Mutex ;
5050use blocking:: { unblock, Unblock } ;
51+ use futures_lite:: future:: FutureExt ;
5152use futures_lite:: io:: { AsyncRead , AsyncSeek , AsyncWrite , AsyncWriteExt } ;
53+ use futures_lite:: ready;
5254use futures_lite:: stream:: Stream ;
53- use futures_lite:: { future, ready} ;
5455
5556#[ doc( no_inline) ]
5657pub use std:: fs:: { FileType , Metadata , Permissions } ;
@@ -282,7 +283,7 @@ pub struct ReadDir(State);
282283/// The `ReadDir` can be either idle or busy performing an asynchronous operation.
283284enum State {
284285 Idle ( Option < std:: fs:: ReadDir > ) ,
285- Busy ( future :: Boxed < ( std:: fs:: ReadDir , Option < io:: Result < std:: fs:: DirEntry > > ) > ) ,
286+ Busy ( blocking :: Task < ( std:: fs:: ReadDir , Option < io:: Result < std:: fs:: DirEntry > > ) > ) ,
286287}
287288
288289impl fmt:: Debug for ReadDir {
@@ -301,14 +302,14 @@ impl Stream for ReadDir {
301302 let mut inner = opt. take ( ) . unwrap ( ) ;
302303
303304 // Start the operation asynchronously.
304- self . 0 = State :: Busy ( Box :: pin ( unblock ( move || {
305+ self . 0 = State :: Busy ( unblock ( move || {
305306 let next = inner. next ( ) ;
306307 ( inner, next)
307- } ) ) ) ;
308+ } ) ) ;
308309 }
309310 // Poll the asynchronous operation the file is currently blocked on.
310311 State :: Busy ( task) => {
311- let ( inner, opt) = ready ! ( task. as_mut ( ) . poll( cx) ) ;
312+ let ( inner, opt) = ready ! ( task. poll( cx) ) ;
312313 self . 0 = State :: Idle ( Some ( inner) ) ;
313314 return Poll :: Ready ( opt. map ( |res| res. map ( |inner| DirEntry ( Arc :: new ( inner) ) ) ) ) ;
314315 }
0 commit comments