Skip to content

Commit

Permalink
axum: Use implicit format-args captures
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Mar 13, 2023
1 parent 59d67ec commit a860e22
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions frameworks/Rust/axum/src/database_pg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
}
});

Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion frameworks/Rust/axum/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn reuse_listener(addr: SocketAddr) -> io::Result<TcpListener> {
#[cfg(unix)]
{
if let Err(e) = socket.set_reuseport(true) {
eprintln!("error setting SO_REUSEPORT: {}", e);
eprintln!("error setting SO_REUSEPORT: {e}");
}
}

Expand Down
4 changes: 2 additions & 2 deletions frameworks/Rust/axum/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ where
<T as FromStr>::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::<T>()
.unwrap_or_else(|_| panic!("could not parse {}", key))
.unwrap_or_else(|_| panic!("could not parse {key}"))
}

#[derive(Debug, Deserialize)]
Expand Down

0 comments on commit a860e22

Please sign in to comment.