Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

Symbols: the thumbnail test reads pixels as four-byte chunks, as clippy asks

Taha-Mahmoodif6715487c000
diff --git a/crates/ui-egui/src/panels/symbols.rs b/crates/ui-egui/src/panels/symbols.rs
index 7cfe65a40..3cc70c803 100644
--- a/crates/ui-egui/src/panels/symbols.rs
+++ b/crates/ui-egui/src/panels/symbols.rs
@@ -422,8 +422,7 @@ mod tests {
/// Pixels of `img` that something paints opaquely, and those of them that are red.
fn painted(img: &vectorcraft_render::Rendered) -> (usize, usize) {
- let px = img.pixels.chunks_exact(4);
- let painted: Vec<&[u8]> = px.filter(|p| p[3] > 200).collect();
+ let painted: Vec<&[u8; 4]> = img.pixels.as_chunks::<4>().0.iter().filter(|p| p[3] > 200).collect();
let red = painted.iter().filter(|p| p[0] > 150 && p[1] < 80 && p[2] < 80).count();
(painted.len(), red)
}