From 64575b85487d6588f7f2b743077b22de2b05539f Mon Sep 17 00:00:00 2001 From: Piotr Dulikowski Date: Fri, 6 Oct 2023 09:57:38 +0200 Subject: [PATCH] examples: fix clippy's complaints about redundant_locals Rust 1.73 got released very recently and introduced a new version of clippy, with new lints. The `parallel` and `parallel-prepared` examples contain code which redefines a local variable: ``` for i in 0..100_000usize { // ... tokio::task::spawn(async move { let i = i; // ... }); } ``` This is completely unnecesary and can be removed, as per clippy's suggestion: ``` error: redundant redefinition of a binding --> examples/parallel-prepared.rs:36:9 | 36 | for i in 0..100_000usize { | ^ ... 44 | let i = i; | ^^^^^^^^^^ | = help: remove the redefinition of `i` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals = note: `#[deny(clippy::redundant_locals)]` on by default ``` --- examples/parallel-prepared.rs | 1 - examples/parallel.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/examples/parallel-prepared.rs b/examples/parallel-prepared.rs index a5a6fabe4f..abab78af64 100644 --- a/examples/parallel-prepared.rs +++ b/examples/parallel-prepared.rs @@ -41,7 +41,6 @@ async fn main() -> Result<()> { let prepared = prepared.clone(); let permit = sem.clone().acquire_owned().await; tokio::task::spawn(async move { - let i = i; session .execute(&prepared, (i as i32, 2 * i as i32)) .await diff --git a/examples/parallel.rs b/examples/parallel.rs index c40fbb31c5..e23c560f41 100644 --- a/examples/parallel.rs +++ b/examples/parallel.rs @@ -33,7 +33,6 @@ async fn main() -> Result<()> { let session = session.clone(); let permit = sem.clone().acquire_owned().await; tokio::task::spawn(async move { - let i = i; session .query( format!(