From c04821df6142b6fe9c4e224062119f497f6f5952 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Tue, 12 Sep 2023 09:52:12 +0200 Subject: [PATCH] Oops --- src/splat.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/splat.rs b/src/splat.rs index a5d43d0..23ca389 100644 --- a/src/splat.rs +++ b/src/splat.rs @@ -618,7 +618,7 @@ pub(crate) fn finalize_splat( ) -> Result<(), Error> { let mut files: std::collections::HashMap< _, - _, + Header<'_>, std::hash::BuildHasherDefault, > = Default::default(); @@ -627,18 +627,15 @@ pub(crate) fn finalize_splat( path: PathBuf, } - fn compare_hashes(existing: &Header<'_>, new: (&SdkHeaders, &Path)) -> anyhow::Result<()> { + fn compare_hashes(existing: &Path, new: &PathBuf) -> anyhow::Result<()> { use crate::util::Sha256; - let existing_path = &existing.path; - let new_path = new.1; - - let existing_hash = Sha256::digest(&std::fs::read(existing_path)?); - let new_hash = Sha256::digest(&std::fs::read(new_path)?); + let existing_hash = Sha256::digest(&std::fs::read(existing)?); + let new_hash = Sha256::digest(&std::fs::read(new)?); anyhow::ensure!( existing_hash == new_hash, - "2 files with same relative path were not equal: '{existing_path}' != '{new_path}'" + "2 files with same relative path were not equal: '{existing}' != '{new}'" ); Ok(()) @@ -649,7 +646,7 @@ pub(crate) fn finalize_splat( if let Some(existing) = files.get(k) { // We already have a file with the same path, if they're the same // as each other it's fine, but if they differ we have an issue - compare_hashes(existing, (&hdrs, v))?; + compare_hashes(&existing.path, v)?; tracing::debug!("skipped {v}, a matching path already exists"); } else { files.insert(