From 92306cb2fec3a4b9d604efe90435950759ca97b5 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 7 Jun 2022 14:16:59 -0400 Subject: [PATCH] Bump to 2021 edition, inline formats, lints * Bump Rust edition 2018 -> 2021 * Use new inline formatting, i.e. `format!("{v}")` instead of `format!("{}", v)` (simple cases only) * use more specific asserts like `assert_ne!` * ignore intellij IDE files * remove a few un-needed namespace prefixes --- bb8/Cargo.toml | 2 +- bb8/src/api.rs | 2 +- postgres/Cargo.toml | 2 +- postgres/examples/hyper.rs | 6 +++--- postgres/examples/static_select.rs | 2 +- redis/Cargo.toml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bb8/Cargo.toml b/bb8/Cargo.toml index fb72a45..008a4d8 100644 --- a/bb8/Cargo.toml +++ b/bb8/Cargo.toml @@ -4,7 +4,7 @@ version = "0.8.0" description = "Full-featured async (tokio-based) connection pool (like r2d2)" license = "MIT" repository = "https://github.com/djc/bb8" -edition = "2018" +edition = "2021" workspace = ".." readme = "../README.md" diff --git a/bb8/src/api.rs b/bb8/src/api.rs index 561120b..9e25986 100644 --- a/bb8/src/api.rs +++ b/bb8/src/api.rs @@ -382,7 +382,7 @@ where { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - RunError::User(ref err) => write!(f, "{}", err), + RunError::User(ref err) => write!(f, "{err}"), RunError::TimedOut => write!(f, "Timed out in bb8"), } } diff --git a/postgres/Cargo.toml b/postgres/Cargo.toml index 4f14e2b..f432bbf 100644 --- a/postgres/Cargo.toml +++ b/postgres/Cargo.toml @@ -4,7 +4,7 @@ version = "0.8.1" description = "Full-featured async (tokio-based) postgres connection pool (like r2d2)" license = "MIT" repository = "https://github.com/djc/bb8" -edition = "2018" +edition = "2021" [features] "with-bit-vec-0_6" = ["tokio-postgres/with-bit-vec-0_6"] diff --git a/postgres/examples/hyper.rs b/postgres/examples/hyper.rs index 788dad8..005b2a0 100644 --- a/postgres/examples/hyper.rs +++ b/postgres/examples/hyper.rs @@ -22,7 +22,7 @@ async fn main() { let pool = match Pool::builder().build(pg_mgr).await { Ok(pool) => pool, - Err(e) => panic!("bb8 error {}", e), + Err(e) => panic!("bb8 error {e}"), }; let _ = Server::bind(&addr) @@ -40,7 +40,7 @@ async fn main() { } Err(e) => { println!("Sending error response"); - Response::new(Body::from(format!("Internal error {:?}", e))) + Response::new(Body::from(format!("Internal error {e:?}"))) } }) } @@ -57,5 +57,5 @@ async fn handler( let stmt = conn.prepare("SELECT 1").await?; let row = conn.query_one(&stmt, &[]).await?; let v = row.get::(0); - Ok(Response::new(Body::from(format!("Got results {:?}", v)))) + Ok(Response::new(Body::from(format!("Got results {v:?}")))) } diff --git a/postgres/examples/static_select.rs b/postgres/examples/static_select.rs index a82ed80..34b2f7d 100644 --- a/postgres/examples/static_select.rs +++ b/postgres/examples/static_select.rs @@ -17,7 +17,7 @@ async fn main() { let pool = match Pool::builder().build(pg_mgr).await { Ok(pool) => pool, - Err(e) => panic!("builder error: {:?}", e), + Err(e) => panic!("builder error: {e:?}"), }; let connection = pool.get().await.unwrap(); diff --git a/redis/Cargo.toml b/redis/Cargo.toml index 97a3c4b..1ed667a 100644 --- a/redis/Cargo.toml +++ b/redis/Cargo.toml @@ -4,7 +4,7 @@ version = "0.11.0" description = "Full-featured async (tokio-based) redis connection pool (like r2d2)" license = "MIT" repository = "https://github.com/djc/bb8" -edition = "2018" +edition = "2021" [dependencies] async-trait = "0.1"