Skip to content

Commit

Permalink
Merge pull request #34 from krtab/del_extra_self
Browse files Browse the repository at this point in the history
Document seemingly unneeded self.clone in write
  • Loading branch information
WaffleLapkin authored Mar 30, 2024
2 parents 846f2d6 + 524e2ab commit e155548
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ impl Hasher for FxHasher {
const _: () = assert!(size_of::<usize>() <= size_of::<u64>());
// Ensure no bytes are discarded by casting to usize
const _: () = assert!(size_of::<u32>() <= size_of::<usize>());
// Copy the 1 word sized state to a local variable to ensure it
// is kept in a register.
// See: https://github.com/rust-lang/rustc-hash/pull/34
let mut state = self.clone();
while let Some(&usize_bytes) = take_first_chunk(&mut bytes) {
state.add_to_hash(usize::from_ne_bytes(usize_bytes));
Expand Down

0 comments on commit e155548

Please sign in to comment.