diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index bb1ce5931d9618..67ced971a5bdd5 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -87,9 +87,8 @@ pub async fn run_all_servers() { let u = url.parse::().unwrap(); warp::redirect(u) }); - let redirect_server_fut = warp::serve(routes) - .bind(([127, 0, 0, 1], REDIRECT_PORT)) - .boxed(); + let redirect_server_fut = + warp::serve(routes).bind(([127, 0, 0, 1], REDIRECT_PORT)); let routes = warp::path::full().map(|path: warp::path::FullPath| { let p = path.as_str(); @@ -98,9 +97,8 @@ pub async fn run_all_servers() { let u = url.parse::().unwrap(); warp::redirect(u) }); - let another_redirect_server_fut = warp::serve(routes) - .bind(([127, 0, 0, 1], ANOTHER_REDIRECT_PORT)) - .boxed(); + let another_redirect_server_fut = + warp::serve(routes).bind(([127, 0, 0, 1], ANOTHER_REDIRECT_PORT)); let routes = warp::path::full().map(|path: warp::path::FullPath| { let p = path.as_str(); @@ -109,9 +107,8 @@ pub async fn run_all_servers() { let u = url.parse::().unwrap(); warp::redirect(u) }); - let double_redirect_server_fut = warp::serve(routes) - .bind(([127, 0, 0, 1], DOUBLE_REDIRECTS_PORT)) - .boxed(); + let double_redirect_server_fut = + warp::serve(routes).bind(([127, 0, 0, 1], DOUBLE_REDIRECTS_PORT)); let routes = warp::path::full().map(|path: warp::path::FullPath| { let p = path.as_str(); @@ -120,9 +117,8 @@ pub async fn run_all_servers() { let u = url.parse::().unwrap(); warp::redirect(u) }); - let inf_redirect_server_fut = warp::serve(routes) - .bind(([127, 0, 0, 1], INF_REDIRECTS_PORT)) - .boxed(); + let inf_redirect_server_fut = + warp::serve(routes).bind(([127, 0, 0, 1], INF_REDIRECTS_PORT)); // redirect server that redirect to absolute paths under same host // redirects /REDIRECT/file_name to /file_name @@ -140,9 +136,8 @@ pub async fn run_all_servers() { .and(warp::fs::dir(root_path())) .map(custom_headers), ); - let absolute_redirect_server_fut = warp::serve(routes) - .bind(([127, 0, 0, 1], REDIRECT_ABSOLUTE_PORT)) - .boxed(); + let absolute_redirect_server_fut = + warp::serve(routes).bind(([127, 0, 0, 1], REDIRECT_ABSOLUTE_PORT)); let echo_server = warp::path("echo_server") .and(warp::post()) @@ -314,27 +309,28 @@ pub async fn run_all_servers() { .or(echo_multipart_file) .or(multipart_form_data); - let http_fut = warp::serve(content_type_handler.clone()) - .bind(([127, 0, 0, 1], PORT)) - .boxed(); + let http_fut = + warp::serve(content_type_handler.clone()).bind(([127, 0, 0, 1], PORT)); let https_fut = warp::serve(content_type_handler.clone()) .tls() .cert_path("std/http/testdata/tls/localhost.crt") .key_path("std/http/testdata/tls/localhost.key") - .bind(([127, 0, 0, 1], HTTPS_PORT)) - .boxed(); - - let mut server_fut = future::join_all(vec![ - http_fut, - https_fut, - redirect_server_fut, - another_redirect_server_fut, - inf_redirect_server_fut, - double_redirect_server_fut, - absolute_redirect_server_fut, - ]) + .bind(([127, 0, 0, 1], HTTPS_PORT)); + + let mut server_fut = async { + futures::join!( + http_fut, + https_fut, + redirect_server_fut, + another_redirect_server_fut, + inf_redirect_server_fut, + double_redirect_server_fut, + absolute_redirect_server_fut, + ) + } .boxed(); + let mut did_print_ready = false; future::poll_fn(move |cx| { let poll_result = server_fut.poll_unpin(cx);