diff --git a/src/unix.rs b/src/unix.rs index f921500..d32080a 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -466,7 +466,7 @@ mod tests_xdg { fn get_temp_path(name: &str, suffix: &str) -> String { let pid = std::process::id(); std::env::temp_dir() - .join(format!("{}.{}.{}", name, pid, suffix)) + .join(format!("{name}.{pid}.{suffix}")) .into_os_string() .into_string() .expect("failed to convert into string") diff --git a/tests/common.rs b/tests/common.rs index aa2c464..07a5af0 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -37,8 +37,7 @@ async fn delayed_response(req: HttpRequest) -> impl Responder { HttpResponse::Ok() .content_type("text/html; charset=utf-8") .body(format!( - "

Delayed by {}ms

", - qs + "

Delayed by {qs}ms

" )) } @@ -50,7 +49,7 @@ where let _ = env_logger::try_init(); // start the server on a random port - let bind_addr = format!("{}:0", host); + let bind_addr = format!("{host}:0"); let (tx, rx) = cbc::bounded(2); let data = AppState { tx: Arc::new(tx.clone()), @@ -110,8 +109,8 @@ where let tmpdir = cwd.join("target").join("tmp"); let html_dir = html_dir.unwrap_or(tmpdir); let id = rand::thread_rng().next_u32(); - let pb = html_dir.join(format!("test.{}.html", id)); - let img_uri = format!("{}?r={}", URI_PNG_1PX, id); + let pb = html_dir.join(format!("test.{id}.html")); + let img_uri = format!("{URI_PNG_1PX}?r={id}"); check_request_received_using(img_uri, "127.0.0.1", |uri, _port| { let url = url_op(&pb); let mut html_file = std::fs::File::create(&pb).expect("failed to create html file"); @@ -132,8 +131,8 @@ where #[allow(dead_code)] pub async fn check_browser(browser: Browser, platform: &str) { - check_request_received(browser, format!("/{}", platform)).await; - check_request_received(browser, format!("/{}/😀😀😀", platform)).await; + check_request_received(browser, format!("/{platform}")).await; + check_request_received(browser, format!("/{platform}/😀😀😀")).await; } const URI_PNG_1PX: &str = "/img/1px.png"; diff --git a/tests/test_android.rs b/tests/test_android.rs index 38a04b9..5f314c8 100644 --- a/tests/test_android.rs +++ b/tests/test_android.rs @@ -20,7 +20,7 @@ mod tests { async fn test_android() { let mut app_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); app_dir.push("tests/test-android-app"); - let uri = format!("/{}", TEST_PLATFORM); + let uri = format!("/{TEST_PLATFORM}"); check_request_received_using(uri, "127.0.0.1", |url, port| { // modify android app code to use the correct url @@ -32,7 +32,7 @@ mod tests { .split('\n') .map(|s| { if s.starts_with("const SERVER_URL") { - format!("const SERVER_URL: &str = \"{}\";", url) + format!("const SERVER_URL: &str = \"{url}\";") } else { s.into() } @@ -55,7 +55,7 @@ mod tests { log::error!("failed to run {:?}", adb_cmd); } - let adb_reverse_port = format!("tcp:{}", port); + let adb_reverse_port = format!("tcp:{port}"); let mut adb_cmd = Command::new("adb"); adb_cmd .arg("reverse") @@ -63,8 +63,7 @@ mod tests { .arg(&adb_reverse_port); assert!( adb_cmd.status().expect("Failed to invoke").success(), - "Failed to run {:?}", - adb_cmd + "Failed to run {adb_cmd:?}" ); // invoke app in android @@ -83,8 +82,7 @@ mod tests { // check for apk run status assert!( apk_run_status.expect("Failed to invoke").success(), - "failed to run {:?}", - apk_run_cmd + "failed to run {apk_run_cmd:?}" ); }) .await; diff --git a/tests/test_wasm.rs b/tests/test_wasm.rs index 7fe3aed..f7ab332 100644 --- a/tests/test_wasm.rs +++ b/tests/test_wasm.rs @@ -15,7 +15,7 @@ mod tests { #[ignore] #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_wasm32() { - let uri = &format!("/{}", TEST_PLATFORM); + let uri = &format!("/{TEST_PLATFORM}"); let ipv4 = "127.0.0.1"; check_request_received_using(uri.into(), ipv4, |url, _port| { // modify html to use the correct url