@@ -62,6 +62,7 @@ macro_rules! assert_event_sequence {
6262 } ;
6363}
6464
65+ #[ allow( clippy:: missing_panics_doc) ]
6566pub async fn assert_event_sequence < S : Stream < Item = Message > + Unpin > (
6667 stream : & mut S ,
6768 expected_options : impl IntoIterator < Item = & ( LogData , String ) > ,
@@ -73,12 +74,12 @@ pub async fn assert_event_sequence<S: Stream<Item = Message> + Unpin>(
7374
7475 while let Some ( expected) = remaining. next ( ) {
7576 let elapsed = start. elapsed ( ) ;
76- if elapsed >= timeout_duration {
77- panic ! (
78- "Timed out waiting for events. Still expecting: {:#?}" ,
79- remaining . collect :: < Vec <_>> ( )
80- ) ;
81- }
77+
78+ assert ! (
79+ elapsed < timeout_duration ,
80+ "Timed out waiting for events. Still expecting: {:#?}" ,
81+ remaining . collect :: < Vec <_>> ( )
82+ ) ;
8283
8384 let time_left = timeout_duration - elapsed;
8485 let message = tokio:: time:: timeout ( time_left, tokio_stream:: StreamExt :: next ( stream) )
@@ -92,25 +93,23 @@ pub async fn assert_event_sequence<S: Stream<Item = Message> + Unpin>(
9293 assert_eq ! (
9394 & expected. 0 ,
9495 event. data( ) ,
95- "Unexpected event: {:#?}\n Expected: {}\n Remaining: {:#?}" ,
96- event,
96+ "Unexpected event: {event:#?}\n Expected: {}\n Remaining: {:#?}" ,
9797 expected. 1 ,
9898 remaining. collect:: <Vec <_>>( )
9999 ) ;
100100 while let Some ( event) = batch. next ( ) {
101- let expected = remaining. next ( ) . unwrap_or_else ( || panic ! ( "Received more events than expected, current: {:#?}\n Streamed batch: {:#?}" , event , batch ) ) ;
101+ let expected = remaining. next ( ) . unwrap_or_else ( || panic ! ( "Received more events than expected, current: {event :#?}\n Streamed batch: {batch :#?}" ) ) ;
102102 assert_eq ! (
103103 & expected. 0 ,
104104 event. data( ) ,
105- "Unexpected event: {:#?}\n Expected: {}\n Remaining: {:#?}" ,
106- event,
105+ "Unexpected event: {event:#?}\n Expected: {}\n Remaining: {:#?}" ,
107106 expected. 1 ,
108107 remaining. collect:: <Vec <_>>( )
109108 ) ;
110109 }
111110 }
112111 Some ( other) => {
113- panic ! ( "Expected Message::Data, got: {:#?}" , other ) ;
112+ panic ! ( "Expected Message::Data, got: {other :#?}" ) ;
114113 }
115114 None => {
116115 panic ! ( "Stream closed while still expecting: {:#?}" , remaining. collect:: <Vec <_>>( ) ) ;
0 commit comments