@@ -425,7 +425,7 @@ impl PickFirstPolicy {
425425 // Partition by family (Basic IPv6 detection via colon).
426426 let ( ipv6, ipv4) : ( Vec < Address > , Vec < Address > ) = tcp_addresses
427427 . into_iter ( )
428- . partition ( |addr| addr. address . contains ( & b ':') ) ;
428+ . partition ( |addr| addr. address . contains ( ':' ) ) ;
429429
430430 // Interleave the two lists so ipv6 and ipv4 addresses are alternated.
431431 let mut interleaved = Vec :: with_capacity ( ipv6. len ( ) + ipv4. len ( ) + unknown. len ( ) ) ;
@@ -738,9 +738,9 @@ mod test {
738738 use std:: time:: Duration ;
739739
740740 use super :: * ;
741- use crate :: client:: load_balancing:: test_utils:: TestChannelController ;
742- use crate :: client :: load_balancing :: test_utils :: TestEvent ;
743- use crate :: client :: load_balancing :: test_utils :: TestWorkScheduler ;
741+ use crate :: client:: load_balancing:: test_utils:: {
742+ TestChannelController , TestEvent , TestWorkScheduler ,
743+ } ;
744744
745745 const DEFAULT_TEST_DURATION : Duration = Duration :: from_secs ( 10 ) ;
746746
@@ -928,7 +928,7 @@ mod test {
928928 let res = state. picker . pick ( & RequestHeaders :: default ( ) ) ;
929929 match res {
930930 PickResult :: Pick ( pick) => {
931- assert_eq ! ( pick. subchannel. address( ) . address, "addr1" )
931+ assert_eq ! ( pick. subchannel. address( ) . address. to_string ( ) , "addr1" )
932932 }
933933 other => panic ! ( "unexpected pick result {:?}" , other) ,
934934 }
@@ -942,7 +942,7 @@ mod test {
942942
943943 // Should connect to addr2.
944944 let addr = expect_connect ( & rx) ;
945- assert_eq ! ( addr. address, "addr2" ) ;
945+ assert_eq ! ( addr. address. to_string ( ) , "addr2" ) ;
946946
947947 // Simulate addr2 succeeding.
948948 let sc2 = policy. subchannels [ 1 ] . clone ( ) ;
@@ -986,16 +986,25 @@ mod test {
986986
987987 // Should create new subchannel for addr2 (was cleared by cleanup).
988988 let sc2 = expect_new_subchannel ( & rx) ;
989- assert_eq ! ( sc2. address( ) . address, "addr2" ) ;
989+ assert_eq ! ( sc2. address( ) . address. to_string ( ) , "addr2" ) ;
990990 // Should create new subchannel for addr3 (was not in previous list).
991991 let sc3 = expect_new_subchannel ( & rx) ;
992- assert_eq ! ( sc3. address( ) . address, "addr3" ) ;
992+ assert_eq ! ( sc3. address( ) . address. to_string ( ) , "addr3" ) ;
993993
994994 // Should NOT have any more events (no Connect, no UpdatePicker),
995995 // because it stuck to the original selected subchannel.
996996 assert ! ( rx. try_recv( ) . is_err( ) , "unexpected event" ) ;
997997
998- assert_eq ! ( policy. selected. as_ref( ) . unwrap( ) . address( ) . address, "addr1" ) ;
998+ assert_eq ! (
999+ policy
1000+ . selected
1001+ . as_ref( )
1002+ . unwrap( )
1003+ . address( )
1004+ . address
1005+ . to_string( ) ,
1006+ "addr1"
1007+ ) ;
9991008 }
10001009
10011010 // If all addresses fail during a connection pass, the LB should update to
@@ -1079,7 +1088,7 @@ mod test {
10791088 let mut resulting_addrs = Vec :: with_capacity ( NUM_ADDRS ) ;
10801089 for _ in 0 ..NUM_ADDRS {
10811090 let sc = expect_new_subchannel ( & rx) ;
1082- resulting_addrs. push ( sc. address ( ) . address ) ;
1091+ resulting_addrs. push ( sc. address ( ) . address . to_string ( ) ) ;
10831092 }
10841093
10851094 // Mock shuffler reverses endpoints: [EP3, EP2, EP1]
@@ -1148,9 +1157,9 @@ mod test {
11481157
11491158 // Should only create subchannels for addr1 and addr2 (2 unique addrs).
11501159 let sc1 = expect_new_subchannel ( & rx) ;
1151- assert_eq ! ( sc1. address( ) . address, "addr1" ) ;
1160+ assert_eq ! ( sc1. address( ) . address. to_string ( ) , "addr1" ) ;
11521161 let sc2 = expect_new_subchannel ( & rx) ;
1153- assert_eq ! ( sc2. address( ) . address, "addr2" ) ;
1162+ assert_eq ! ( sc2. address( ) . address. to_string ( ) , "addr2" ) ;
11541163
11551164 // Verify no 3rd subchannel was created.
11561165 while let Ok ( event) = rx. try_recv ( ) {
@@ -1217,7 +1226,7 @@ mod test {
12171226
12181227 // Expect Connect event for addr2 due to timer expiration.
12191228 let addr = expect_connect ( & rx) ;
1220- assert_eq ! ( addr. address, "addr2" ) ;
1229+ assert_eq ! ( addr. address. to_string ( ) , "addr2" ) ;
12211230 }
12221231
12231232 // If all addresses fail during a connection pass, the LB should enter
@@ -1250,7 +1259,7 @@ mod test {
12501259
12511260 // Should automatically call connect() again.
12521261 let addr = expect_connect ( & rx) ;
1253- assert_eq ! ( addr. address, "addr1" ) ;
1262+ assert_eq ! ( addr. address. to_string ( ) , "addr1" ) ;
12541263 }
12551264
12561265 // If the LB is in steady state, and a new address becomes ready, it should
@@ -1265,7 +1274,7 @@ mod test {
12651274
12661275 // Should failover to addr2: expect Connect(addr2).
12671276 let addr = expect_connect ( & rx) ;
1268- assert_eq ! ( addr. address, "addr2" ) ;
1277+ assert_eq ! ( addr. address. to_string ( ) , "addr2" ) ;
12691278
12701279 // While addr2 is connecting, simulate addr1 going IDLE (backoff over).
12711280 policy. subchannel_update (
@@ -1300,7 +1309,7 @@ mod test {
13001309 ) ;
13011310 expect_request_resolution ( & rx) ;
13021311 let addr = expect_connect ( & rx) ;
1303- assert_eq ! ( addr. address, "addr1" ) ;
1312+ assert_eq ! ( addr. address. to_string ( ) , "addr1" ) ;
13041313
13051314 // Confirm LB is in steady state.
13061315 assert ! ( policy. steady_state. is_some( ) ) ;
@@ -1317,7 +1326,7 @@ mod test {
13171326
13181327 // Now it should automatically call connect() again.
13191328 let addr = expect_connect ( & rx) ;
1320- assert_eq ! ( addr. address, "addr1" ) ;
1329+ assert_eq ! ( addr. address. to_string ( ) , "addr1" ) ;
13211330
13221331 // Simulate addr1 successfully connecting and becoming READY.
13231332 policy. subchannel_update (
@@ -1335,7 +1344,7 @@ mod test {
13351344 let res = state. picker . pick ( & RequestHeaders :: default ( ) ) ;
13361345 match res {
13371346 PickResult :: Pick ( pick) => {
1338- assert_eq ! ( pick. subchannel. address( ) . address, "addr1" ) ;
1347+ assert_eq ! ( pick. subchannel. address( ) . address. to_string ( ) , "addr1" ) ;
13391348 }
13401349 other => panic ! ( "unexpected pick result {:?}" , other) ,
13411350 }
@@ -1354,7 +1363,7 @@ mod test {
13541363
13551364 // Expect Connect(addr2).
13561365 let addr = expect_connect ( & rx) ;
1357- assert_eq ! ( addr. address, "addr2" ) ;
1366+ assert_eq ! ( addr. address. to_string ( ) , "addr2" ) ;
13581367
13591368 // Simulate addr1 backing off and transitioning to IDLE early
13601369 // (while addr2 is still connecting).
@@ -1393,7 +1402,7 @@ mod test {
13931402 // Expect an immediate Connect(addr1) event triggered by the exhaustion
13941403 // loop sweeping up the early IDLE subchannel.
13951404 let addr = expect_connect ( & rx) ;
1396- assert_eq ! ( addr. address, "addr1" ) ;
1405+ assert_eq ! ( addr. address. to_string ( ) , "addr1" ) ;
13971406 }
13981407
13991408 // This test is meant to validate that if a new address with different
@@ -1492,7 +1501,7 @@ mod test {
14921501 policy. work ( None , controller. as_mut ( ) ) ;
14931502
14941503 let addr = expect_connect ( & rx) ;
1495- assert_eq ! ( addr. address, "addr2" ) ;
1504+ assert_eq ! ( addr. address. to_string ( ) , "addr2" ) ;
14961505
14971506 // 2. Simulate addr2 failing first while addr1 is still in flight.
14981507 let sc2 = policy. subchannels [ 1 ] . clone ( ) ;
@@ -1574,7 +1583,7 @@ mod test {
15741583 let res = state. picker . pick ( & RequestHeaders :: default ( ) ) ;
15751584 let sc1 = match res {
15761585 PickResult :: Pick ( pick) => {
1577- assert_eq ! ( pick. subchannel. address( ) . address, "addr1" ) ;
1586+ assert_eq ! ( pick. subchannel. address( ) . address. to_string ( ) , "addr1" ) ;
15781587 pick. subchannel
15791588 }
15801589 other => panic ! ( "unexpected pick result {:?}" , other) ,
@@ -1610,7 +1619,7 @@ mod test {
16101619
16111620 // 7. Verify that the policy initiates a reconnection to addr1.
16121621 let addr = expect_connect ( & rx) ;
1613- assert_eq ! ( addr. address, "addr1" ) ;
1622+ assert_eq ! ( addr. address. to_string ( ) , "addr1" ) ;
16141623
16151624 // And the picker goes to Connecting.
16161625 let state = expect_picker_update ( & rx) ;
0 commit comments