diff options
| author | Jack O'Connor <[email protected]> | 2021-11-30 14:03:32 -0500 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2021-11-30 14:05:08 -0500 |
| commit | da4c792d8094f35c05c41c9aeb5dfe4aa67ca1ac (patch) | |
| tree | 779166e1ea30db6370a65820d93b80d88072c4c1 /reference_impl/reference_impl.rs | |
| parent | 315e44f875051d53f7007e646860b83a34361372 (diff) | |
add an assert and remove an iter_mut in reference_impl
Suggested in https://github.com/rust-lang/rust-clippy/issues/8039.
Diffstat (limited to 'reference_impl/reference_impl.rs')
| -rw-r--r-- | reference_impl/reference_impl.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/reference_impl/reference_impl.rs b/reference_impl/reference_impl.rs index e669f36..83ac795 100644 --- a/reference_impl/reference_impl.rs +++ b/reference_impl/reference_impl.rs @@ -125,8 +125,9 @@ fn first_8_words(compression_output: [u32; 16]) -> [u32; 8] { } fn words_from_little_endian_bytes(bytes: &[u8], words: &mut [u32]) { - for (bytes_block, word) in bytes.chunks_exact(4).zip(words.iter_mut()) { - *word = u32::from_le_bytes(bytes_block.try_into().unwrap()); + debug_assert_eq!(bytes.len(), 4 * words.len()); + for (four_bytes, word) in bytes.chunks_exact(4).zip(words) { + *word = u32::from_le_bytes(four_bytes.try_into().unwrap()); } } |
