@@ -97,7 +97,7 @@ impl File {
9797 /// ```
9898 pub async fn open < P : AsRef < Path > > ( path : P ) -> io:: Result < File > {
9999 let path = path. as_ref ( ) . to_owned ( ) ;
100- let file = blocking:: spawn ( async move { std:: fs:: File :: open ( & path) } ) . await ?;
100+ let file = blocking:: spawn ( move || std:: fs:: File :: open ( & path) ) . await ?;
101101 Ok ( file. into ( ) )
102102 }
103103
@@ -132,7 +132,7 @@ impl File {
132132 /// ```
133133 pub async fn create < P : AsRef < Path > > ( path : P ) -> io:: Result < File > {
134134 let path = path. as_ref ( ) . to_owned ( ) ;
135- let file = blocking:: spawn ( async move { std:: fs:: File :: create ( & path) } ) . await ?;
135+ let file = blocking:: spawn ( move || std:: fs:: File :: create ( & path) ) . await ?;
136136 Ok ( file. into ( ) )
137137 }
138138
@@ -165,7 +165,7 @@ impl File {
165165 } )
166166 . await ?;
167167
168- blocking:: spawn ( async move { state. file . sync_all ( ) } ) . await
168+ blocking:: spawn ( move || state. file . sync_all ( ) ) . await
169169 }
170170
171171 /// Synchronizes OS-internal buffered contents to disk.
@@ -201,7 +201,7 @@ impl File {
201201 } )
202202 . await ?;
203203
204- blocking:: spawn ( async move { state. file . sync_data ( ) } ) . await
204+ blocking:: spawn ( move || state. file . sync_data ( ) ) . await
205205 }
206206
207207 /// Truncates or extends the file.
@@ -234,7 +234,7 @@ impl File {
234234 } )
235235 . await ?;
236236
237- blocking:: spawn ( async move { state. file . set_len ( size) } ) . await
237+ blocking:: spawn ( move || state. file . set_len ( size) ) . await
238238 }
239239
240240 /// Reads the file's metadata.
@@ -253,7 +253,7 @@ impl File {
253253 /// ```
254254 pub async fn metadata ( & self ) -> io:: Result < Metadata > {
255255 let file = self . file . clone ( ) ;
256- blocking:: spawn ( async move { file. metadata ( ) } ) . await
256+ blocking:: spawn ( move || file. metadata ( ) ) . await
257257 }
258258
259259 /// Changes the permissions on the file.
@@ -282,7 +282,7 @@ impl File {
282282 /// ```
283283 pub async fn set_permissions ( & self , perm : Permissions ) -> io:: Result < ( ) > {
284284 let file = self . file . clone ( ) ;
285- blocking:: spawn ( async move { file. set_permissions ( perm) } ) . await
285+ blocking:: spawn ( move || file. set_permissions ( perm) ) . await
286286 }
287287}
288288
@@ -702,7 +702,7 @@ impl LockGuard<State> {
702702 self . register ( cx) ;
703703
704704 // Start a read operation asynchronously.
705- blocking:: spawn ( async move {
705+ blocking:: spawn ( move || {
706706 // Read some data from the file into the cache.
707707 let res = {
708708 let State { file, cache, .. } = & mut * self ;
@@ -811,7 +811,7 @@ impl LockGuard<State> {
811811 self . register ( cx) ;
812812
813813 // Start a write operation asynchronously.
814- blocking:: spawn ( async move {
814+ blocking:: spawn ( move || {
815815 match ( & * self . file ) . write_all ( & self . cache ) {
816816 Ok ( _) => {
817817 // Switch to idle mode.
@@ -844,7 +844,7 @@ impl LockGuard<State> {
844844 self . register ( cx) ;
845845
846846 // Start a flush operation asynchronously.
847- blocking:: spawn ( async move {
847+ blocking:: spawn ( move || {
848848 match ( & * self . file ) . flush ( ) {
849849 Ok ( ( ) ) => {
850850 // Mark the file as flushed.
0 commit comments