@@ -10,7 +10,7 @@ use sacp::schema::{
1010 AgentCapabilities , InitializeProxyRequest , InitializeRequest , InitializeResponse ,
1111 ProtocolVersion ,
1212} ;
13- use sacp:: { Agent , Client , Conductor , DynConnectTo , Proxy , ConnectTo } ;
13+ use sacp:: { Agent , Client , Conductor , ConnectTo , DynConnectTo , Proxy } ;
1414use sacp_conductor:: { ConductorImpl , ProxiesAndAgent } ;
1515use std:: sync:: Arc ;
1616use std:: sync:: Mutex ;
@@ -73,7 +73,8 @@ impl ConnectTo<Conductor> for InitComponent {
7373 let config = self . config ;
7474 let config2 = Arc :: clone ( & config) ;
7575
76- Proxy . builder ( )
76+ Proxy
77+ . builder ( )
7778 . name ( "init-component" )
7879 // Handle InitializeProxyRequest (we're a proxy)
7980 . on_receive_request_from (
@@ -121,7 +122,8 @@ async fn run_test_with_components(
121122
122123 let transport = sacp:: ByteStreams :: new ( editor_out. compat_write ( ) , editor_in. compat ( ) ) ;
123124
124- sacp:: Client . builder ( )
125+ sacp:: Client
126+ . builder ( )
125127 . name ( "editor-to-connector" )
126128 . with_spawned ( |_cx| async move {
127129 ConductorImpl :: new_agent (
@@ -144,8 +146,10 @@ async fn test_single_component_gets_initialize_request() -> Result<(), sacp::Err
144146 // Single component (agent) should receive InitializeRequest - we use ElizaAgent
145147 // which properly handles InitializeRequest
146148 run_test_with_components ( vec ! [ ] , async |connection_to_editor| {
147- let init_response =
148- recv ( connection_to_editor. send_request ( InitializeRequest :: new ( ProtocolVersion :: LATEST ) ) ) . await ;
149+ let init_response = recv (
150+ connection_to_editor. send_request ( InitializeRequest :: new ( ProtocolVersion :: LATEST ) ) ,
151+ )
152+ . await ;
149153
150154 assert ! (
151155 init_response. is_ok( ) ,
@@ -166,18 +170,23 @@ async fn test_two_components_proxy_gets_initialize_proxy() -> Result<(), sacp::E
166170 // Second component (agent, ElizaAgent) gets InitializeRequest
167171 let component1 = InitConfig :: new ( ) ;
168172
169- run_test_with_components ( vec ! [ InitComponent :: new( & component1) ] , async |connection_to_editor| {
170- let init_response =
171- recv ( connection_to_editor. send_request ( InitializeRequest :: new ( ProtocolVersion :: LATEST ) ) ) . await ;
173+ run_test_with_components (
174+ vec ! [ InitComponent :: new( & component1) ] ,
175+ async |connection_to_editor| {
176+ let init_response = recv (
177+ connection_to_editor. send_request ( InitializeRequest :: new ( ProtocolVersion :: LATEST ) ) ,
178+ )
179+ . await ;
172180
173- assert ! (
174- init_response. is_ok( ) ,
175- "Initialize should succeed: {:?}" ,
176- init_response
177- ) ;
181+ assert ! (
182+ init_response. is_ok( ) ,
183+ "Initialize should succeed: {:?}" ,
184+ init_response
185+ ) ;
178186
179- Ok :: < ( ) , sacp:: Error > ( ( ) )
180- } )
187+ Ok :: < ( ) , sacp:: Error > ( ( ) )
188+ } ,
189+ )
181190 . await ?;
182191
183192 // First component (proxy) should receive InitializeProxyRequest
@@ -205,8 +214,10 @@ async fn test_three_components_all_proxies_get_initialize_proxy() -> Result<(),
205214 InitComponent :: new( & component2) ,
206215 ] ,
207216 async |connection_to_editor| {
208- let init_response =
209- recv ( connection_to_editor. send_request ( InitializeRequest :: new ( ProtocolVersion :: LATEST ) ) ) . await ;
217+ let init_response = recv (
218+ connection_to_editor. send_request ( InitializeRequest :: new ( ProtocolVersion :: LATEST ) ) ,
219+ )
220+ . await ;
210221
211222 assert ! (
212223 init_response. is_ok( ) ,
@@ -241,11 +252,9 @@ async fn test_three_components_all_proxies_get_initialize_proxy() -> Result<(),
241252struct BadProxy ;
242253
243254impl ConnectTo < Conductor > for BadProxy {
244- async fn connect_to (
245- self ,
246- client : impl ConnectTo < Proxy > ,
247- ) -> Result < ( ) , sacp:: Error > {
248- Proxy . builder ( )
255+ async fn connect_to ( self , client : impl ConnectTo < Proxy > ) -> Result < ( ) , sacp:: Error > {
256+ Proxy
257+ . builder ( )
249258 . name ( "bad-proxy" )
250259 . on_receive_request_from (
251260 Client ,
@@ -275,7 +284,8 @@ async fn run_bad_proxy_test(
275284
276285 let transport = sacp:: ByteStreams :: new ( editor_out. compat_write ( ) , editor_in. compat ( ) ) ;
277286
278- sacp:: Client . builder ( )
287+ sacp:: Client
288+ . builder ( )
279289 . name ( "editor-to-connector" )
280290 . with_spawned ( |_cx| async move {
281291 ConductorImpl :: new_agent (
@@ -301,8 +311,10 @@ async fn test_conductor_rejects_initialize_proxy_forwarded_to_agent() -> Result<
301311 vec ! [ DynConnectTo :: new( BadProxy ) ] ,
302312 DynConnectTo :: new ( ElizaAgent :: new ( true ) ) ,
303313 async |connection_to_editor| {
304- let init_response =
305- recv ( connection_to_editor. send_request ( InitializeRequest :: new ( ProtocolVersion :: LATEST ) ) ) . await ;
314+ let init_response = recv (
315+ connection_to_editor. send_request ( InitializeRequest :: new ( ProtocolVersion :: LATEST ) ) ,
316+ )
317+ . await ;
306318
307319 if let Err ( err) = init_response {
308320 assert ! (
@@ -342,8 +354,10 @@ async fn test_conductor_rejects_initialize_proxy_forwarded_to_proxy() -> Result<
342354 ] ,
343355 DynConnectTo :: new ( ElizaAgent :: new ( true ) ) , // Agent
344356 async |connection_to_editor| {
345- let init_response =
346- recv ( connection_to_editor. send_request ( InitializeRequest :: new ( ProtocolVersion :: LATEST ) ) ) . await ;
357+ let init_response = recv (
358+ connection_to_editor. send_request ( InitializeRequest :: new ( ProtocolVersion :: LATEST ) ) ,
359+ )
360+ . await ;
347361
348362 // The error may come through recv() or bubble up through the test harness
349363 if let Err ( err) = init_response {
0 commit comments