11use futures:: channel:: { mpsc, oneshot} ;
22use futures:: executor:: { block_on, block_on_stream} ;
3- use futures:: future:: { FutureExt , poll_fn } ;
4- use futures:: stream :: { Stream , StreamExt } ;
3+ use futures:: future:: { poll_fn , FutureExt } ;
4+ use futures:: pin_mut ;
55use futures:: sink:: { Sink , SinkExt } ;
6+ use futures:: stream:: { Stream , StreamExt } ;
67use futures:: task:: { Context , Poll } ;
7- use futures:: pin_mut;
88use futures_test:: task:: { new_count_waker, noop_context} ;
9- use std:: sync:: { Arc , Mutex } ;
109use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
10+ use std:: sync:: { Arc , Mutex } ;
1111use std:: thread;
1212
1313trait AssertSend : Send { }
@@ -77,7 +77,7 @@ fn send_shared_recv() {
7777fn send_recv_threads ( ) {
7878 let ( mut tx, rx) = mpsc:: channel :: < i32 > ( 16 ) ;
7979
80- let t = thread:: spawn ( move || {
80+ let t = thread:: spawn ( move || {
8181 block_on ( tx. send ( 1 ) ) . unwrap ( ) ;
8282 } ) ;
8383
@@ -204,7 +204,7 @@ fn stress_shared_unbounded() {
204204 const NTHREADS : u32 = 8 ;
205205 let ( tx, rx) = mpsc:: unbounded :: < i32 > ( ) ;
206206
207- let t = thread:: spawn ( move || {
207+ let t = thread:: spawn ( move || {
208208 let result: Vec < _ > = block_on ( rx. collect ( ) ) ;
209209 assert_eq ! ( result. len( ) , ( AMT * NTHREADS ) as usize ) ;
210210 for item in result {
@@ -215,7 +215,7 @@ fn stress_shared_unbounded() {
215215 for _ in 0 ..NTHREADS {
216216 let tx = tx. clone ( ) ;
217217
218- thread:: spawn ( move || {
218+ thread:: spawn ( move || {
219219 for _ in 0 ..AMT {
220220 tx. unbounded_send ( 1 ) . unwrap ( ) ;
221221 }
@@ -233,7 +233,7 @@ fn stress_shared_bounded_hard() {
233233 const NTHREADS : u32 = 8 ;
234234 let ( tx, rx) = mpsc:: channel :: < i32 > ( 0 ) ;
235235
236- let t = thread:: spawn ( move || {
236+ let t = thread:: spawn ( move || {
237237 let result: Vec < _ > = block_on ( rx. collect ( ) ) ;
238238 assert_eq ! ( result. len( ) , ( AMT * NTHREADS ) as usize ) ;
239239 for item in result {
@@ -297,9 +297,9 @@ fn stress_receiver_multi_task_bounded_hard() {
297297 }
298298 Poll :: Ready ( None ) => {
299299 * rx_opt = None ;
300- break
301- } ,
302- Poll :: Pending => { } ,
300+ break ;
301+ }
302+ Poll :: Pending => { }
303303 }
304304 }
305305 } else {
@@ -311,7 +311,6 @@ fn stress_receiver_multi_task_bounded_hard() {
311311 th. push ( t) ;
312312 }
313313
314-
315314 for i in 0 ..AMT {
316315 block_on ( tx. send ( i) ) . unwrap ( ) ;
317316 }
@@ -328,7 +327,7 @@ fn stress_receiver_multi_task_bounded_hard() {
328327/// after sender dropped.
329328#[ test]
330329fn stress_drop_sender ( ) {
331- fn list ( ) -> impl Stream < Item = i32 > {
330+ fn list ( ) -> impl Stream < Item = i32 > {
332331 let ( tx, rx) = mpsc:: channel ( 1 ) ;
333332 thread:: spawn ( move || {
334333 block_on ( send_one_two_three ( tx) ) ;
@@ -407,9 +406,7 @@ fn stress_poll_ready() {
407406 let mut threads = Vec :: new ( ) ;
408407 for _ in 0 ..NTHREADS {
409408 let sender = tx. clone ( ) ;
410- threads. push ( thread:: spawn ( move || {
411- block_on ( stress_poll_ready_sender ( sender, AMT ) )
412- } ) ) ;
409+ threads. push ( thread:: spawn ( move || block_on ( stress_poll_ready_sender ( sender, AMT ) ) ) ) ;
413410 }
414411 drop ( tx) ;
415412
@@ -436,7 +433,7 @@ fn try_send_1() {
436433 for i in 0 ..N {
437434 loop {
438435 if tx. try_send ( i) . is_ok ( ) {
439- break
436+ break ;
440437 }
441438 }
442439 }
@@ -542,8 +539,8 @@ fn is_connected_to() {
542539
543540#[ test]
544541fn hash_receiver ( ) {
545- use std:: hash:: Hasher ;
546542 use std:: collections:: hash_map:: DefaultHasher ;
543+ use std:: hash:: Hasher ;
547544
548545 let mut hasher_a1 = DefaultHasher :: new ( ) ;
549546 let mut hasher_a2 = DefaultHasher :: new ( ) ;
0 commit comments