@@ -97,7 +97,7 @@ impl File {
97
97
/// ```
98
98
pub async fn open < P : AsRef < Path > > ( path : P ) -> io:: Result < File > {
99
99
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 ?;
101
101
Ok ( file. into ( ) )
102
102
}
103
103
@@ -132,7 +132,7 @@ impl File {
132
132
/// ```
133
133
pub async fn create < P : AsRef < Path > > ( path : P ) -> io:: Result < File > {
134
134
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 ?;
136
136
Ok ( file. into ( ) )
137
137
}
138
138
@@ -165,7 +165,7 @@ impl File {
165
165
} )
166
166
. await ?;
167
167
168
- blocking:: spawn ( async move { state. file . sync_all ( ) } ) . await
168
+ blocking:: spawn ( move || state. file . sync_all ( ) ) . await
169
169
}
170
170
171
171
/// Synchronizes OS-internal buffered contents to disk.
@@ -201,7 +201,7 @@ impl File {
201
201
} )
202
202
. await ?;
203
203
204
- blocking:: spawn ( async move { state. file . sync_data ( ) } ) . await
204
+ blocking:: spawn ( move || state. file . sync_data ( ) ) . await
205
205
}
206
206
207
207
/// Truncates or extends the file.
@@ -234,7 +234,7 @@ impl File {
234
234
} )
235
235
. await ?;
236
236
237
- blocking:: spawn ( async move { state. file . set_len ( size) } ) . await
237
+ blocking:: spawn ( move || state. file . set_len ( size) ) . await
238
238
}
239
239
240
240
/// Reads the file's metadata.
@@ -253,7 +253,7 @@ impl File {
253
253
/// ```
254
254
pub async fn metadata ( & self ) -> io:: Result < Metadata > {
255
255
let file = self . file . clone ( ) ;
256
- blocking:: spawn ( async move { file. metadata ( ) } ) . await
256
+ blocking:: spawn ( move || file. metadata ( ) ) . await
257
257
}
258
258
259
259
/// Changes the permissions on the file.
@@ -282,7 +282,7 @@ impl File {
282
282
/// ```
283
283
pub async fn set_permissions ( & self , perm : Permissions ) -> io:: Result < ( ) > {
284
284
let file = self . file . clone ( ) ;
285
- blocking:: spawn ( async move { file. set_permissions ( perm) } ) . await
285
+ blocking:: spawn ( move || file. set_permissions ( perm) ) . await
286
286
}
287
287
}
288
288
@@ -702,7 +702,7 @@ impl LockGuard<State> {
702
702
self . register ( cx) ;
703
703
704
704
// Start a read operation asynchronously.
705
- blocking:: spawn ( async move {
705
+ blocking:: spawn ( move || {
706
706
// Read some data from the file into the cache.
707
707
let res = {
708
708
let State { file, cache, .. } = & mut * self ;
@@ -811,7 +811,7 @@ impl LockGuard<State> {
811
811
self . register ( cx) ;
812
812
813
813
// Start a write operation asynchronously.
814
- blocking:: spawn ( async move {
814
+ blocking:: spawn ( move || {
815
815
match ( & * self . file ) . write_all ( & self . cache ) {
816
816
Ok ( _) => {
817
817
// Switch to idle mode.
@@ -844,7 +844,7 @@ impl LockGuard<State> {
844
844
self . register ( cx) ;
845
845
846
846
// Start a flush operation asynchronously.
847
- blocking:: spawn ( async move {
847
+ blocking:: spawn ( move || {
848
848
match ( & * self . file ) . flush ( ) {
849
849
Ok ( ( ) ) => {
850
850
// Mark the file as flushed.
0 commit comments