From c61d999bee5b3b533f376c07714e030b9b5576e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Fri, 17 Jan 2025 10:21:47 +0100 Subject: [PATCH] clippy fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabian Grünbichler --- src/commands.rs | 2 +- src/upload_queue.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index bf1b872..22e7135 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -218,7 +218,7 @@ pub(crate) async fn register_image( match index { Some(index) => { - let index_size = ((device_size + chunk_size - 1) / chunk_size) as usize; + let index_size = device_size.div_ceil(chunk_size) as usize; if index_size != index.index_count() { bail!("previous backup has different size than current state, cannot do incremental backup (drive: {})", archive_name); } diff --git a/src/upload_queue.rs b/src/upload_queue.rs index 261886c..e0737da 100644 --- a/src/upload_queue.rs +++ b/src/upload_queue.rs @@ -91,7 +91,7 @@ async fn upload_handler( let mut digest_list = Vec::new(); let mut offset_list = Vec::new(); - let index_size = ((device_size + chunk_size - 1) / chunk_size) as usize; + let index_size = device_size.div_ceil(chunk_size) as usize; let mut index = Vec::with_capacity(index_size); index.resize(index_size, [0u8; 32]);