From dd4a1dcffaf26b0361c744cae1ebc5d4816d0268 Mon Sep 17 00:00:00 2001 From: Robin Rolf Date: Tue, 9 May 2023 21:44:17 +0200 Subject: [PATCH] Move bufwriter out of loop --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 30141e4..0a0a40a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -343,7 +343,7 @@ dependencies = [ [[package]] name = "imgur_id7" -version = "0.1.0" +version = "0.1.2" dependencies = [ "async-channel", "atomic-counter", diff --git a/Cargo.toml b/Cargo.toml index 4da9d95..9e9a2de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "imgur_id7" -version = "0.1.1" +version = "0.1.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index 8b0dec3..89a5d0c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -228,8 +228,8 @@ async fn main() { .create(true) .open(out_file.as_str()).await { Ok(mut filef) => { + let mut file = BufWriter::new(&mut filef); loop { - let mut file = BufWriter::new(&mut filef); if let Some(found) = done_rx.recv().await { match file.write_all(format!("https://i.imgur.com/{}.jpg", found).as_bytes()).await { Ok(_) => {}