about summary refs log tree commit diff
path: root/tvix/nix-compat
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-10-14T16·53+0100
committerclbot <clbot@tvl.fyi>2023-10-14T17·55+0000
commitcc040a5ad339c793d97b532bfc0a7965c02c5e23 (patch)
tree19951414e9ae02f2bda377c31ce2d316374bd6ba /tvix/nix-compat
parent4ae0f428bd207fdf3730d0f6ff73c7410ae9cd7b (diff)
refactor(tvix/nix-compat/derivation): fod_digest return [u8; 32] r/6808
This is of known length.

Change-Id: Iba48ccc486d5bf9e38ec1a2da6e7b80997d2c6ca
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9723
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Diffstat (limited to 'tvix/nix-compat')
-rw-r--r--tvix/nix-compat/src/derivation/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/tvix/nix-compat/src/derivation/mod.rs b/tvix/nix-compat/src/derivation/mod.rs
index 3c08d61831ba..7a15f0ee06e5 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<Vec<u8>> {
+    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.