Lint: as_chunks in two tests too (import_fuzz, render encode)
With the library hits fixed, clippy 1.99 reaches two more in test code. cargo clippy --workspace --all-targets -- -D warnings now passes on 1.99. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U9TrG4w49oSRYbP3cqxA3D
This commit is contained in:
parent
945dcbae1d
commit
719e648de1
|
|
@ -1097,7 +1097,7 @@ fn emf_of(records: &[(u32, Vec<u8>)]) -> Vec<u8> {
|
|||
/// A placeable WMF of a 1 × 1 inch box holding `records`.
|
||||
fn wmf_of(records: &[(u16, Vec<u8>)]) -> Vec<u8> {
|
||||
let mut b: Vec<u8> = vec![0xD7, 0xCD, 0xC6, 0x9A, 0, 0, 0, 0, 0, 0, 0xA0, 0x05, 0xA0, 0x05, 0xA0, 0x05, 0, 0, 0, 0];
|
||||
let sum = b.chunks_exact(2).fold(0u16, |a, w| a ^ u16::from_le_bytes([w[0], w[1]]));
|
||||
let sum = b.as_chunks::<2>().0.iter().fold(0u16, |a, w| a ^ u16::from_le_bytes(*w));
|
||||
b.extend(sum.to_le_bytes());
|
||||
b.extend([1, 0, 9, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
for (function, body) in records {
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ fn anti_alias_none_is_the_same_on_every_thread_count() {
|
|||
};
|
||||
let (st, mt) = (render(0), render(3));
|
||||
for img in [&st, &mt] {
|
||||
assert!(img.to_straight().chunks_exact(4).all(|p| p[3] == 0 || p[3] == 255), "hard edges");
|
||||
assert!(img.to_straight().as_chunks::<4>().0.iter().all(|p| p[3] == 0 || p[3] == 255), "hard edges");
|
||||
}
|
||||
let worst = st.pixels.iter().zip(&mt.pixels).map(|(a, b)| a.abs_diff(*b)).max().unwrap();
|
||||
assert!(worst <= 4, "max channel difference {worst}");
|
||||
|
|
|
|||
Loading…
Reference in New Issue