@@ -119,11 +119,7 @@ impl Session for WsSession {
119119 . handle_query ( & pattern, from, to, limit)
120120 . await
121121 {
122- Ok ( ( records, total) ) => ServerMessage :: QueryResult {
123- id,
124- records,
125- total,
126- } ,
122+ Ok ( ( records, total) ) => ServerMessage :: QueryResult { id, records, total } ,
127123 Err ( message) => ServerMessage :: Error {
128124 code : ErrorCode :: ServerError ,
129125 topic : None ,
@@ -192,8 +188,8 @@ mod tests {
192188 use std:: sync:: Mutex ;
193189 use std:: time:: Duration ;
194190
195- use aimdb_core:: session:: { run_session, SessionConfig } ;
196191 use aimdb_core:: router:: RouterBuilder ;
192+ use aimdb_core:: session:: { run_session, SessionConfig } ;
197193 use aimdb_core:: { Connection , SessionLimits , TransportResult } ;
198194 use tokio:: sync:: mpsc;
199195
@@ -266,8 +262,10 @@ mod tests {
266262 // snapshot, then a bus broadcast fans out as a Data frame.
267263 #[ tokio:: test]
268264 async fn subscribe_ack_snapshot_and_fanout ( ) {
269- let dispatch =
270- dispatch_with ( Arc :: new ( OneSnap ( "sensors/temp" . into ( ) , b"\" last\" " . to_vec ( ) ) ) ) ;
265+ let dispatch = dispatch_with ( Arc :: new ( OneSnap (
266+ "sensors/temp" . into ( ) ,
267+ b"\" last\" " . to_vec ( ) ,
268+ ) ) ) ;
271269 let mgr = dispatch. client_mgr . clone ( ) ;
272270
273271 let ( tx, rx) = mpsc:: unbounded_channel :: < Vec < u8 > > ( ) ;
@@ -303,8 +301,12 @@ mod tests {
303301
304302 // Ack + snapshot should have been emitted, in order.
305303 let msgs = parse ( & out) ;
306- assert ! ( matches!( & msgs[ 0 ] , ServerMessage :: Subscribed { topics } if topics == & vec![ "sensors/temp" . to_string( ) ] ) ) ;
307- assert ! ( matches!( & msgs[ 1 ] , ServerMessage :: Snapshot { topic, .. } if topic == "sensors/temp" ) ) ;
304+ assert ! (
305+ matches!( & msgs[ 0 ] , ServerMessage :: Subscribed { topics } if topics == & vec![ "sensors/temp" . to_string( ) ] )
306+ ) ;
307+ assert ! (
308+ matches!( & msgs[ 1 ] , ServerMessage :: Snapshot { topic, .. } if topic == "sensors/temp" )
309+ ) ;
308310
309311 // A bus broadcast now fans out to this subscription as a Data frame.
310312 mgr. broadcast ( "sensors/temp" , b"\" 22.5\" " ) . await ;
@@ -313,7 +315,9 @@ mod tests {
313315 let data = msgs
314316 . iter ( )
315317 . find_map ( |m| match m {
316- ServerMessage :: Data { topic, payload, .. } => Some ( ( topic. clone ( ) , payload. clone ( ) ) ) ,
318+ ServerMessage :: Data { topic, payload, .. } => {
319+ Some ( ( topic. clone ( ) , payload. clone ( ) ) )
320+ }
317321 _ => None ,
318322 } )
319323 . expect ( "a Data frame" ) ;
0 commit comments