1
+ use alloc:: collections:: BTreeSet ;
2
+ use core:: fmt:: { self , Debug } ;
3
+ use core:: ops:: { Deref , DerefMut } ;
4
+ use core:: pin:: Pin ;
5
+ use core:: task:: { Context , Poll } ;
1
6
use futures_core:: stream:: Stream ;
2
7
use futures_core:: Future ;
3
8
use slab:: Slab ;
4
- use std:: collections:: BTreeSet ;
5
- use std:: fmt:: { self , Debug } ;
6
- use std:: ops:: { Deref , DerefMut } ;
7
- use std:: pin:: Pin ;
8
- use std:: task:: { Context , Poll } ;
9
9
10
10
use crate :: utils:: { PollState , PollVec , WakerVec } ;
11
11
@@ -237,7 +237,7 @@ impl<F: Future> FutureGroup<F> {
237
237
238
238
// Set the corresponding state
239
239
self . states [ index] . set_pending ( ) ;
240
- let mut readiness = self . wakers . readiness ( ) . lock ( ) . unwrap ( ) ;
240
+ let mut readiness = self . wakers . readiness ( ) ;
241
241
readiness. set_ready ( index) ;
242
242
243
243
key
@@ -273,7 +273,7 @@ impl<F: Future> FutureGroup<F> {
273
273
impl < F : Future > FutureGroup < F > {
274
274
fn poll_next_inner (
275
275
self : Pin < & mut Self > ,
276
- cx : & std :: task :: Context < ' _ > ,
276
+ cx : & Context < ' _ > ,
277
277
) -> Poll < Option < ( Key , <F as Future >:: Output ) > > {
278
278
let mut this = self . project ( ) ;
279
279
@@ -283,7 +283,7 @@ impl<F: Future> FutureGroup<F> {
283
283
}
284
284
285
285
// Set the top-level waker and check readiness
286
- let mut readiness = this. wakers . readiness ( ) . lock ( ) . unwrap ( ) ;
286
+ let mut readiness = this. wakers . readiness ( ) ;
287
287
readiness. set_waker ( cx. waker ( ) ) ;
288
288
if !readiness. any_ready ( ) {
289
289
// Nothing is ready yet
@@ -326,7 +326,7 @@ impl<F: Future> FutureGroup<F> {
326
326
} ;
327
327
328
328
// Lock readiness so we can use it again
329
- readiness = this. wakers . readiness ( ) . lock ( ) . unwrap ( ) ;
329
+ readiness = this. wakers . readiness ( ) ;
330
330
}
331
331
}
332
332
@@ -343,10 +343,7 @@ impl<F: Future> FutureGroup<F> {
343
343
impl < F : Future > Stream for FutureGroup < F > {
344
344
type Item = <F as Future >:: Output ;
345
345
346
- fn poll_next (
347
- self : Pin < & mut Self > ,
348
- cx : & mut std:: task:: Context < ' _ > ,
349
- ) -> Poll < Option < Self :: Item > > {
346
+ fn poll_next ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Option < Self :: Item > > {
350
347
match self . poll_next_inner ( cx) {
351
348
Poll :: Ready ( Some ( ( _key, item) ) ) => Poll :: Ready ( Some ( item) ) ,
352
349
Poll :: Ready ( None ) => Poll :: Ready ( None ) ,
@@ -396,10 +393,7 @@ impl<F: Future> DerefMut for Keyed<F> {
396
393
impl < F : Future > Stream for Keyed < F > {
397
394
type Item = ( Key , <F as Future >:: Output ) ;
398
395
399
- fn poll_next (
400
- self : Pin < & mut Self > ,
401
- cx : & mut std:: task:: Context < ' _ > ,
402
- ) -> Poll < Option < Self :: Item > > {
396
+ fn poll_next ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Option < Self :: Item > > {
403
397
let mut this = self . project ( ) ;
404
398
this. group . as_mut ( ) . poll_next_inner ( cx)
405
399
}
@@ -408,8 +402,8 @@ impl<F: Future> Stream for Keyed<F> {
408
402
#[ cfg( test) ]
409
403
mod test {
410
404
use super :: FutureGroup ;
405
+ use core:: future;
411
406
use futures_lite:: prelude:: * ;
412
- use std:: future;
413
407
414
408
#[ test]
415
409
fn smoke ( ) {
0 commit comments