@@ -2482,10 +2482,6 @@ mod tests {
24822482
24832483 use super :: * ;
24842484
2485- fn unused_return_channel < M > ( ) -> oneshot:: Sender < M > {
2486- oneshot:: channel ( ) . 0
2487- }
2488-
24892485 #[ cfg( target_os = "linux" ) ] // uses abstract names
24902486 #[ tracing_test:: traced_test]
24912487 #[ tokio:: test]
@@ -2508,16 +2504,16 @@ mod tests {
25082504 // out of the buffer because NetRx could not ack through the closed
25092505 // channel.
25102506 {
2511- let tx = crate :: channel:: dial :: < u64 > ( addr. clone ( ) ) . unwrap ( ) ;
2512- tx. try_post ( 123 , unused_return_channel ( ) ) ;
2507+ let tx: ChannelTx < u64 > = crate :: channel:: dial :: < u64 > ( addr. clone ( ) ) . unwrap ( ) ;
2508+ tx. post ( 123 ) ;
25132509 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 123 ) ;
25142510 }
25152511
25162512 {
25172513 let tx = dial :: < u64 > ( addr. clone ( ) ) . unwrap ( ) ;
2518- tx. try_post ( 321 , unused_return_channel ( ) ) ;
2519- tx. try_post ( 111 , unused_return_channel ( ) ) ;
2520- tx. try_post ( 444 , unused_return_channel ( ) ) ;
2514+ tx. post ( 321 ) ;
2515+ tx. post ( 111 ) ;
2516+ tx. post ( 444 ) ;
25212517
25222518 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 321 ) ;
25232519 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 111 ) ;
@@ -2553,14 +2549,14 @@ mod tests {
25532549 // Dial the channel before we actually serve it.
25542550 let addr = ChannelAddr :: Unix ( socket_addr. clone ( ) ) ;
25552551 let tx = crate :: channel:: dial :: < u64 > ( addr. clone ( ) ) . unwrap ( ) ;
2556- tx. try_post ( 123 , unused_return_channel ( ) ) ;
2552+ tx. post ( 123 ) ;
25572553
25582554 let ( _, mut rx) = net:: unix:: serve :: < u64 > ( socket_addr) . unwrap ( ) ;
25592555 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 123 ) ;
25602556
2561- tx. try_post ( 321 , unused_return_channel ( ) ) ;
2562- tx. try_post ( 111 , unused_return_channel ( ) ) ;
2563- tx. try_post ( 444 , unused_return_channel ( ) ) ;
2557+ tx. post ( 321 ) ;
2558+ tx. post ( 111 ) ;
2559+ tx. post ( 444 ) ;
25642560
25652561 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 321 ) ;
25662562 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 111 ) ;
@@ -2577,15 +2573,15 @@ mod tests {
25772573 let ( addr, mut rx) = tcp:: serve :: < u64 > ( "[::1]:0" . parse ( ) . unwrap ( ) ) . unwrap ( ) ;
25782574 {
25792575 let tx = dial :: < u64 > ( addr. clone ( ) ) . unwrap ( ) ;
2580- tx. try_post ( 123 , unused_return_channel ( ) ) ;
2576+ tx. post ( 123 ) ;
25812577 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 123 ) ;
25822578 }
25832579
25842580 {
25852581 let tx = dial :: < u64 > ( addr. clone ( ) ) . unwrap ( ) ;
2586- tx. try_post ( 321 , unused_return_channel ( ) ) ;
2587- tx. try_post ( 111 , unused_return_channel ( ) ) ;
2588- tx. try_post ( 444 , unused_return_channel ( ) ) ;
2582+ tx. post ( 321 ) ;
2583+ tx. post ( 111 ) ;
2584+ tx. post ( 444 ) ;
25892585
25902586 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 321 ) ;
25912587 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 111 ) ;
@@ -2620,7 +2616,7 @@ mod tests {
26202616 {
26212617 // Leave some headroom because Tx will wrap the payload in Frame::Message.
26222618 let message = "a" . repeat ( default_size_in_bytes - 1024 ) ;
2623- tx. try_post ( message. clone ( ) , unused_return_channel ( ) ) ;
2619+ tx. post ( message. clone ( ) ) ;
26242620 assert_eq ! ( rx. recv( ) . await . unwrap( ) , message) ;
26252621 }
26262622 // Bigger than the default size will fail.
@@ -2669,15 +2665,15 @@ mod tests {
26692665 let ( local_addr, mut rx) = net:: meta:: serve :: < u64 > ( meta_addr) . unwrap ( ) ;
26702666 {
26712667 let tx = dial :: < u64 > ( local_addr. clone ( ) ) . unwrap ( ) ;
2672- tx. try_post ( 123 , unused_return_channel ( ) ) ;
2668+ tx. post ( 123 ) ;
26732669 }
26742670 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 123 ) ;
26752671
26762672 {
26772673 let tx = dial :: < u64 > ( local_addr. clone ( ) ) . unwrap ( ) ;
2678- tx. try_post ( 321 , unused_return_channel ( ) ) ;
2679- tx. try_post ( 111 , unused_return_channel ( ) ) ;
2680- tx. try_post ( 444 , unused_return_channel ( ) ) ;
2674+ tx. post ( 321 ) ;
2675+ tx. post ( 111 ) ;
2676+ tx. post ( 444 ) ;
26812677 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 321 ) ;
26822678 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 111 ) ;
26832679 assert_eq ! ( rx. recv( ) . await . unwrap( ) , 444 ) ;
@@ -3338,7 +3334,7 @@ mod tests {
33383334
33393335 async fn net_tx_send ( tx : & NetTx < u64 > , msgs : & [ u64 ] ) {
33403336 for msg in msgs {
3341- tx. try_post ( * msg, unused_return_channel ( ) ) ;
3337+ tx. post ( * msg) ;
33423338 }
33433339 }
33443340
@@ -3657,7 +3653,7 @@ mod tests {
36573653 let tx = NetTx :: < u64 > :: new ( link) ;
36583654 let mut tx_status = tx. status ( ) . clone ( ) ;
36593655 // send a message
3660- tx. try_post ( 100 , unused_return_channel ( ) ) ;
3656+ tx. post ( 100 ) ;
36613657 let ( mut reader, writer) = take_receiver ( & receiver_storage) . await ;
36623658 // Confirm message is sent to rx.
36633659 verify_stream ( & mut reader, & [ ( 0u64 , 100u64 ) ] , None , line ! ( ) ) . await ;
@@ -3675,7 +3671,7 @@ mod tests {
36753671 assert ! ( !tx_status. has_changed( ) . unwrap( ) ) ;
36763672 assert_eq ! ( * tx_status. borrow( ) , TxStatus :: Active ) ;
36773673
3678- tx. try_post ( 101 , unused_return_channel ( ) ) ;
3674+ tx. post ( 101 ) ;
36793675 // Confirm message is sent to rx.
36803676 verify_message ( & mut reader, ( 1u64 , 101u64 ) , line ! ( ) ) . await ;
36813677
@@ -3751,7 +3747,7 @@ mod tests {
37513747 RealClock
37523748 . sleep ( Duration :: from_micros ( rand:: random :: < u64 > ( ) % 100 ) )
37533749 . await ;
3754- tx. try_post ( message, unused_return_channel ( ) ) ;
3750+ tx. post ( message) ;
37553751 }
37563752 tracing:: debug!( "NetTx sent all messages" ) ;
37573753 // It is important to return tx instead of dropping it here, because
@@ -3819,7 +3815,7 @@ mod tests {
38193815 RealClock
38203816 . sleep ( Duration :: from_micros ( rand:: random :: < u64 > ( ) % 100 ) )
38213817 . await ;
3822- tx. try_post ( message, unused_return_channel ( ) ) ;
3818+ tx. post ( message) ;
38233819 }
38243820 RealClock . sleep ( Duration :: from_secs ( 5 ) ) . await ;
38253821 tracing:: debug!( "NetTx sent all messages" ) ;
@@ -3916,7 +3912,7 @@ mod tests {
39163912 . map ( char:: from)
39173913 . collect :: < String > ( ) ;
39183914 for _ in 0 ..total_num_msgs {
3919- tx2. try_post ( random_string. clone ( ) , unused_return_channel ( ) ) ;
3915+ tx2. post ( random_string. clone ( ) ) ;
39203916 }
39213917 } ) ) ;
39223918 }
0 commit comments