@@ -1061,7 +1061,6 @@ fn connection_poisoning() {
10611061 assert_eq ! ( num_requests. load( Ordering :: SeqCst ) , 5 ) ;
10621062}
10631063
1064-
10651064// -------------------------------------------------------
10661065// Below is our custom code for testing hyper legacy-client behavior with mock connections for PR #184
10671066// We use fully qualified paths for all types and identifiers to make this code
@@ -1147,7 +1146,10 @@ impl hyper::rt::Read for MockConnection {
11471146 buf : hyper:: rt:: ReadBufCursor < ' _ > ,
11481147 ) -> std:: task:: Poll < std:: result:: Result < ( ) , std:: io:: Error > > {
11491148 // Log the current state of the failed flag for debugging.
1150- eprintln ! ( "poll_read: failed={}" , self . failed. load( std:: sync:: atomic:: Ordering :: SeqCst ) ) ;
1149+ eprintln ! (
1150+ "poll_read: failed={}" ,
1151+ self . failed. load( std:: sync:: atomic:: Ordering :: SeqCst )
1152+ ) ;
11511153 // Check if the connection is marked as failed.
11521154 // If true, return the stored error immediately to simulate a connection failure.
11531155 if self . failed . load ( std:: sync:: atomic:: Ordering :: SeqCst ) {
@@ -1188,7 +1190,10 @@ impl hyper::rt::Write for MockConnection {
11881190 // Increment the total bytes written for tracking.
11891191 self . bytes_written += bytes;
11901192 // Log the number of bytes written and the running total.
1191- eprintln ! ( "poll_write: wrote {} bytes, total={}" , bytes, self . bytes_written) ;
1193+ eprintln ! (
1194+ "poll_write: wrote {} bytes, total={}" ,
1195+ bytes, self . bytes_written
1196+ ) ;
11921197 // If error_tx is present, signal an unexpected write (used in error tests).
11931198 // This helps detect writes when the connection should fail early.
11941199 if let Some ( tx) = self . error_tx . take ( ) {
@@ -1272,9 +1277,8 @@ impl tower_service::Service<hyper::Uri> for MockConnector {
12721277 type Error = std:: io:: Error ;
12731278 type Future = std:: pin:: Pin <
12741279 Box <
1275- dyn futures_util:: Future <
1276- Output = std:: result:: Result < Self :: Response , Self :: Error > ,
1277- > + Send ,
1280+ dyn futures_util:: Future < Output = std:: result:: Result < Self :: Response , Self :: Error > >
1281+ + Send ,
12781282 > ,
12791283 > ;
12801284
@@ -1362,11 +1366,9 @@ async fn test_connection_error_propagation_pr184() {
13621366 let connector = crate :: MockConnector :: new ( io_builder, Some ( io_error. clone ( ) ) ) ;
13631367 // Build the hyper client with TokioExecutor and our connector.
13641368 // pool_max_idle_per_host(0) disables connection pooling for a fresh connection.
1365- let client = hyper_util:: client:: legacy:: Client :: builder (
1366- hyper_util:: rt:: TokioExecutor :: new ( )
1367- )
1368- . pool_max_idle_per_host ( 0 )
1369- . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
1369+ let client = hyper_util:: client:: legacy:: Client :: builder ( hyper_util:: rt:: TokioExecutor :: new ( ) )
1370+ . pool_max_idle_per_host ( 0 )
1371+ . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
13701372 // Build a GET request to a mock URI with custom headers.
13711373 // Uses mixed-case headers to match your style, ensuring case-insensitive handling.
13721374 let request = hyper:: Request :: builder ( )
@@ -1417,11 +1419,9 @@ async fn test_incomplete_message_error_pr184() {
14171419 let connector = crate :: MockConnector :: new ( io_builder, None ) ;
14181420 // Build the hyper client with TokioExecutor and our connector.
14191421 // pool_max_idle_per_host(0) disables pooling for a fresh connection.
1420- let client = hyper_util:: client:: legacy:: Client :: builder (
1421- hyper_util:: rt:: TokioExecutor :: new ( )
1422- )
1423- . pool_max_idle_per_host ( 0 )
1424- . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
1422+ let client = hyper_util:: client:: legacy:: Client :: builder ( hyper_util:: rt:: TokioExecutor :: new ( ) )
1423+ . pool_max_idle_per_host ( 0 )
1424+ . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
14251425 // Build a GET request to a mock URI with headers.
14261426 // Uses mixed-case headers to match test_connection_error_propagation_pr184.
14271427 // Empty body ensures focus on response parsing failure.
@@ -1487,11 +1487,9 @@ async fn test_successful_connection() {
14871487 let connector = crate :: MockConnector :: new ( io_builder, None ) ;
14881488 // Build the hyper client with TokioExecutor and our connector.
14891489 // pool_max_idle_per_host(0) ensures a fresh connection.
1490- let client = hyper_util:: client:: legacy:: Client :: builder (
1491- hyper_util:: rt:: TokioExecutor :: new ( )
1492- )
1493- . pool_max_idle_per_host ( 0 )
1494- . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
1490+ let client = hyper_util:: client:: legacy:: Client :: builder ( hyper_util:: rt:: TokioExecutor :: new ( ) )
1491+ . pool_max_idle_per_host ( 0 )
1492+ . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
14951493 // Build a GET request to a mock URI with headers.
14961494 // Uses mixed-case headers to match your style and verify case-insensitive handling.
14971495 let request = hyper:: Request :: builder ( )
0 commit comments