From a3484541d5966753d50f7ce16462efc4972d81b8 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sat, 11 Mar 2023 18:23:53 +0100 Subject: [PATCH] axum: Use implicit format-args captures --- frameworks/Rust/axum/src/database_pg.rs | 6 +++--- frameworks/Rust/axum/src/server.rs | 2 +- frameworks/Rust/axum/src/utils.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frameworks/Rust/axum/src/database_pg.rs b/frameworks/Rust/axum/src/database_pg.rs index 3526a75de3a0..56e07553af32 100644 --- a/frameworks/Rust/axum/src/database_pg.rs +++ b/frameworks/Rust/axum/src/database_pg.rs @@ -45,7 +45,7 @@ impl PgConnection { // Spawn connection tokio::spawn(async move { if let Err(error) = conn.await { - eprintln!("Connection error: {}", error); + eprintln!("Connection error: {error}"); } }); @@ -59,14 +59,14 @@ impl PgConnection { q.push_str("UPDATE world SET randomnumber = CASE id "); for _ in 1..=num { - let _ = write!(q, "when ${} then ${} ", pl, pl + 1); + let _ = write!(q, "when ${pl} then ${} ", pl + 1); pl += 2; } q.push_str("ELSE randomnumber END WHERE id IN ("); for _ in 1..=num { - let _ = write!(q, "${},", pl); + let _ = write!(q, "${pl},"); pl += 1; } diff --git a/frameworks/Rust/axum/src/server.rs b/frameworks/Rust/axum/src/server.rs index 118f35c8d836..29e165f6f5c0 100644 --- a/frameworks/Rust/axum/src/server.rs +++ b/frameworks/Rust/axum/src/server.rs @@ -27,7 +27,7 @@ fn reuse_listener(addr: SocketAddr) -> io::Result { #[cfg(unix)] { if let Err(e) = socket.set_reuseport(true) { - eprintln!("error setting SO_REUSEPORT: {}", e); + eprintln!("error setting SO_REUSEPORT: {e}"); } } diff --git a/frameworks/Rust/axum/src/utils.rs b/frameworks/Rust/axum/src/utils.rs index a8f0b005d0e6..89ecaeae6abd 100644 --- a/frameworks/Rust/axum/src/utils.rs +++ b/frameworks/Rust/axum/src/utils.rs @@ -13,9 +13,9 @@ where ::Err: Debug, { env::var(key) - .unwrap_or_else(|_| panic!("{} environment variable was not set", key)) + .unwrap_or_else(|_| panic!("{key} environment variable was not set")) .parse::() - .unwrap_or_else(|_| panic!("could not parse {}", key)) + .unwrap_or_else(|_| panic!("could not parse {key}")) } #[derive(Debug, Deserialize)]