about summary refs log tree commit diff
path: root/tvix/cli/src
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-08-19T21·33+0200
committerflokli <flokli@flokli.de>2023-08-20T19·44+0000
commit9cb38c5ba5e51e8843ee2ab210842701c5a6d7ce (patch)
tree21932c6ea1a163f645fb2f3cbd81432586534ac8 /tvix/cli/src
parent2d687e068abaa3ca876c33361a7b2befa2ccdf0e (diff)
refactor(tvix/cli): stop parsing NixHash twice r/6496
We already have the parsed output_hash from above, no need to construct
it again.

Change-Id: Ie6d924ab446137c25c29fbeaf671aa7e5418262d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9110
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/cli/src')
-rw-r--r--tvix/cli/src/derivation.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/tvix/cli/src/derivation.rs b/tvix/cli/src/derivation.rs
index 6cde7a366c2b..a6f1beccc959 100644
--- a/tvix/cli/src/derivation.rs
+++ b/tvix/cli/src/derivation.rs
@@ -128,12 +128,8 @@ fn populate_output_configuration(
 
                 // construct the NixHashWithMode.
                 out.hash_with_mode = match hash_mode.as_deref() {
-                    None | Some("flat") => Some(nixhash::NixHashWithMode::Flat(
-                        nixhash::NixHash::new(output_hash.algo, output_hash.digest),
-                    )),
-                    Some("recursive") => Some(nixhash::NixHashWithMode::Recursive(
-                        nixhash::NixHash::new(output_hash.algo, output_hash.digest),
-                    )),
+                    None | Some("flat") => Some(nixhash::NixHashWithMode::Flat(output_hash)),
+                    Some("recursive") => Some(nixhash::NixHashWithMode::Recursive(output_hash)),
                     Some(other) => {
                         return Err(Error::InvalidOutputHashMode(other.to_string()).into())
                     }