From cc040a5ad339c793d97b532bfc0a7965c02c5e23 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 14 Oct 2023 17:53:02 +0100 Subject: refactor(tvix/nix-compat/derivation): fod_digest return [u8; 32] This is of known length. Change-Id: Iba48ccc486d5bf9e38ec1a2da6e7b80997d2c6ca Reviewed-on: https://cl.tvl.fyi/c/depot/+/9723 Autosubmit: flokli Tested-by: BuildkiteCI Reviewed-by: Connor Brewster --- tvix/nix-compat/src/derivation/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tvix/nix-compat/src') diff --git a/tvix/nix-compat/src/derivation/mod.rs b/tvix/nix-compat/src/derivation/mod.rs index 3c08d61831..7a15f0ee06 100644 --- a/tvix/nix-compat/src/derivation/mod.rs +++ b/tvix/nix-compat/src/derivation/mod.rs @@ -115,7 +115,7 @@ impl Derivation { /// Returns the FOD digest, if the derivation is fixed-output, or None if /// it's not. - fn fod_digest(&self) -> Option> { + fn fod_digest(&self) -> Option<[u8; 32]> { if self.outputs.len() != 1 { return None; } @@ -128,7 +128,7 @@ impl Derivation { out_output.path )) .finalize() - .to_vec(), + .into(), ) } @@ -184,10 +184,10 @@ impl Derivation { let mut hasher = Sha256::new(); hasher.update(replaced_derivation.to_aterm_bytes()); - hasher.finalize().to_vec() + hasher.finalize().into() }); - NixHash::Sha256(digest.try_into().unwrap()) + NixHash::Sha256(digest) } /// This calculates all output paths of a Derivation and updates the struct. -- cgit 1.4.1