Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kimono-koans committed Dec 10, 2024
1 parent 6017754 commit 0135b44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/library/diff_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ impl DiffCopy {

#[inline]
fn hash(bytes: &[u8]) -> u64 {
use foldhash::fast::RandomState;
use foldhash::fast::FixedState;
use std::hash::{BuildHasher, Hasher};

let random_state = RandomState::default();
let mut hash = random_state.build_hasher();
let s = LazyLock::new(|| FixedState::default());
let mut hash = s.build_hasher();

hash.write(bytes);
hash.finish()
Expand Down
7 changes: 4 additions & 3 deletions src/library/file_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use std::fs::{create_dir_all, read_dir, set_permissions};
use std::iter::Iterator;
use std::os::unix::fs::{chown, FileTypeExt, MetadataExt};
use std::path::Path;
use std::sync::LazyLock;

const CHAR_KIND: SFlag = nix::sys::stat::SFlag::S_IFCHR;
const BLK_KIND: SFlag = nix::sys::stat::SFlag::S_IFBLK;
Expand Down Expand Up @@ -295,11 +296,11 @@ pub struct HashFileContents<'a> {

impl<'a> HashFileContents<'a> {
pub fn path_to_hash(path: &Path) -> u64 {
use foldhash::fast::RandomState;
use foldhash::quality::FixedState;
use std::hash::{BuildHasher, Hasher};

let random_state = RandomState::default();
let mut hash = random_state.build_hasher();
let s = LazyLock::new(|| FixedState::default());
let mut hash = s.build_hasher();

HashFileContents::from(path).hash(&mut hash);

Expand Down

0 comments on commit 0135b44

Please sign in to comment.