FastHasher reads whole words with as_chunks faa9cd0579d3
What clippy 1.98 asks for; the same code on 1.97.
- Author
- Andy McCall @andymccall <[email protected]>
- When
- · 2026-10-03 21:26 UTC
- Signature
- ✔ signed by Andy McCall
- Hash
faa9cd0579d37845979389ccc2816e166c7907359a3975e23942dd8f7634f252- Depends on
- 0bdc3f91a39f
- Depended on by
- nothing yet
- In bookmarks
- agents-in-readme bare-hashes carried-not-removed carry-identical doctor-trust identical-sides keyless-tags main merge-remote-bookmark only-help-103 paths-for-resolutions-and-amend push-notes show-stat subrepo-pin-state switch-says
- In tags
- v0.10.0 v0.11.0 v0.4.0 v0.4.1 v0.4.2 v0.4.3 v0.4.4 v0.4.5 v0.4.6 v0.5.0 v0.5.1 v0.6.0 v0.7.0 v0.8.0 v0.9.0
- Edits
- 2 atoms, 0 tree operations, 1 file
Browse the tree at this change
modified crates/oxy-core/src/fasthash.rs +3 −4
| … | 43 unchanged lines |
||
| 44 | 44 | impl Hasher for FastHasher { |
|
| 45 | 45 | #[inline] |
|
| 46 | 46 | fn write(&mut self, bytes: &[u8]) { |
|
| 47 | - | let mut chunks = bytes.chunks_exact(8); |
|
| 48 | - | for c in &mut chunks { |
|
| 49 | - | self.mix(u64::from_le_bytes(c.try_into().unwrap())); |
|
| 47 | + | let (chunks, rest) = bytes.as_chunks::<8>(); |
|
| 48 | + | for c in chunks { |
|
| 49 | + | self.mix(u64::from_le_bytes(*c)); |
|
| 50 | 50 | } |
|
| 51 | - | let rest = chunks.remainder(); |
|
| 52 | 51 | if !rest.is_empty() { |
|
| 53 | 52 | let mut b = [0u8; 8]; |
|
| 54 | 53 | b[..rest.len()].copy_from_slice(rest); |
|
| … | 77 unchanged lines |