From 9cb38c5ba5e51e8843ee2ab210842701c5a6d7ce Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 19 Aug 2023 23:33:31 +0200 Subject: refactor(tvix/cli): stop parsing NixHash twice 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 Tested-by: BuildkiteCI --- tvix/cli/src/derivation.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'tvix/cli/src') 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()) } -- cgit 1.4.1