From 98fe5daca8be7869bf182f2e91bf7d192111cb01 Mon Sep 17 00:00:00 2001 From: max-ishere <47008271+max-ishere@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:30:19 +0200 Subject: [PATCH] Fixed formatting --- src/render/pff2.rs | 47 ++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/render/pff2.rs b/src/render/pff2.rs index d35a17d..7e89644 100644 --- a/src/render/pff2.rs +++ b/src/render/pff2.rs @@ -20,7 +20,7 @@ impl Glyph { let index = y * self.width + x; let byte_index = index / 8; let bit_index = 7 - (index % 8); - let mask =1 << bit_index; + let mask = 1 << bit_index; Some((self.bitmap[byte_index] & mask) != 0) } @@ -28,26 +28,29 @@ impl Glyph { #[cfg(test)] mod tests { - use crate::parser::pff2::Glyph; - - #[test_case( - 8, 1, &[0b00000001], - 7, 0 => 1; - "right bit one line" - )] - #[test_case( - 8, 1, &[0b10000000], - 0, 0 => 1; - "left bit one line" - )] - fn foo(width: usize, height: usize, bitmap: &[u8], x: usize, y: usize) -> u8 { - let glyph = Glyph { - width, - height, - bitmap: bitmap.into(), - ..Default::default() - }; - - glyph.pixel(x, y).unwrap() as u8 + #[allow(non_snake_case)] + mod Glyph { + use crate::parser::pff2::Glyph; + + #[test_case( + 8, 1, &[0b00000001], + 7, 0 => 1; + "right bit one line" + )] + #[test_case( + 8, 1, &[0b10000000], + 0, 0 => 1; + "left bit one line" + )] + fn pixel(width: usize, height: usize, bitmap: &[u8], x: usize, y: usize) -> u8 { + let glyph = Glyph { + width, + height, + bitmap: bitmap.into(), + ..Default::default() + }; + + glyph.pixel(x, y).unwrap() as u8 + } } }