From ca5ac608b5537e4a8272c234e8961293e81e8404 Mon Sep 17 00:00:00 2001 From: Caemor <11088935+caemor@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:51:48 +0100 Subject: [PATCH] Two Clippy improvements (0..len -> iter.enum, assert_eq(..,true) -> assert) --- examples/epd7in5_v2.rs | 4 ++-- src/epd1in02/mod.rs | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/epd7in5_v2.rs b/examples/epd7in5_v2.rs index 61a1583f..8c7d5abb 100644 --- a/examples/epd7in5_v2.rs +++ b/examples/epd7in5_v2.rs @@ -123,9 +123,9 @@ fn main() -> Result<(), SPIError> { &FONT_9X18_BOLD, &FONT_10X20, ]; - for n in 0..fonts.len() { + for (n, font) in fonts.iter().enumerate() { let style = MonoTextStyleBuilder::new() - .font(fonts[n]) + .font(font) .text_color(Color::White) .background_color(Color::Black) .build(); diff --git a/src/epd1in02/mod.rs b/src/epd1in02/mod.rs index 17d9566f..6eafea13 100644 --- a/src/epd1in02/mod.rs +++ b/src/epd1in02/mod.rs @@ -521,38 +521,38 @@ mod tests { #[test] fn inside_of_screen() { - assert_eq!(is_window_size_ok(0, 0, 80, 128), true); + assert!(is_window_size_ok(0, 0, 80, 128)); } #[test] fn x_too_big() { - assert_eq!(is_window_size_ok(8, 8, 80, 1), false); + assert!(!is_window_size_ok(8, 8, 80, 1)); } #[test] fn y_too_big() { - assert_eq!(is_window_size_ok(8, 8, 8, 121), false); + assert!(!is_window_size_ok(8, 8, 8, 121)); } #[test] fn x_is_not_multiple_of_8() { - assert_eq!(is_window_size_ok(1, 0, 72, 128), false); + assert!(!is_window_size_ok(1, 0, 72, 128)); } #[test] fn width_is_not_multiple_of_8() { - assert_eq!(is_window_size_ok(0, 0, 79, 128), false); + assert!(!is_window_size_ok(0, 0, 79, 128)); } #[test] fn buffer_size_incorrect() { let buf = [0u8; 10]; - assert_eq!(is_buffer_size_ok(&buf, 10, 10), false); + assert!(!is_buffer_size_ok(&buf, 10, 10)); } #[test] fn buffer_size_correct() { let buf = [0u8; 10]; - assert_eq!(is_buffer_size_ok(&buf, 8, 10), true); + assert!(is_buffer_size_ok(&buf, 8, 10)); } }