From 391920f4fec6ebb54f66584eca22ae20357af160 Mon Sep 17 00:00:00 2001 From: Mingwei Zhang Date: Sat, 24 Oct 2026 05:53:48 -0700 Subject: [PATCH] style: clear the remaining clippy and rustfmt findings under all targets `cargo clippy --all-features --all-targets` reported four findings in examples and tests, so the repository could not gate on that flag set: a redundant borrow in a println, two hand-rolled div_ceil calls, and an assert_eq against a literal bool. --- examples/read_csv_in_tar.rs | 2 +- src/s3/mod.rs | 2 +- tests/basic_integration.rs | 2 +- tests/s3_large_upload.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/read_csv_in_tar.rs b/examples/read_csv_in_tar.rs index c33497b..91b1e5d 100644 --- a/examples/read_csv_in_tar.rs +++ b/examples/read_csv_in_tar.rs @@ -12,7 +12,7 @@ fn main() { let mut entry = entry.unwrap(); let path = entry.path().unwrap().to_string_lossy().to_string(); if path.ends_with("csv") { - println!("found file {}", &path); + println!("found file {path}"); println!("reading content now... (sleep for 3 seconds)"); sleep(Duration::from_secs(3)); let mut content: String = String::default(); diff --git a/src/s3/mod.rs b/src/s3/mod.rs index 11797aa..2570ebe 100644 --- a/src/s3/mod.rs +++ b/src/s3/mod.rs @@ -1410,7 +1410,7 @@ mod tests { let (cs, tp) = calculate_chunk_size(hundred_gb, chunk_size); assert!(tp <= 10_000); assert!(cs >= 8 * 1024 * 1024); - assert_eq!(tp, ((hundred_gb + cs - 1) / cs) as usize); + assert_eq!(tp, hundred_gb.div_ceil(cs) as usize); } #[test] diff --git a/tests/basic_integration.rs b/tests/basic_integration.rs index a509b29..1a2a82f 100644 --- a/tests/basic_integration.rs +++ b/tests/basic_integration.rs @@ -224,7 +224,7 @@ FZr4y1T605mmkIwGPQ== #[test] fn test_file_extension_plain() { - assert_eq!(oneio::get_reader("tests/test_data.txt").is_ok(), true); + assert!(oneio::get_reader("tests/test_data.txt").is_ok()); } #[cfg(feature = "any_gz")] diff --git a/tests/s3_large_upload.rs b/tests/s3_large_upload.rs index 51c3d14..cbaeaed 100644 --- a/tests/s3_large_upload.rs +++ b/tests/s3_large_upload.rs @@ -32,7 +32,7 @@ fn test_large_multipart_upload() { ); println!( "Expected parts: {} (at 8MB chunks)", - (size + 8 * 1024 * 1024 - 1) / (8 * 1024 * 1024) + size.div_ceil(8 * 1024 * 1024) ); let unique_id = std::time::SystemTime::now()