diff options
author | Florian Klink <flokli@flokli.de> | 2024-01-02T12·23+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-01-03T13·19+0000 |
commit | 9abe735061a91422936775a8164953d21c5cc70a (patch) | |
tree | 9872760029a0c9ce48621878524a89a961ba877b /tvix/glue | |
parent | 7f030fe2655136299315837c1f4c2b45065ef5d4 (diff) |
refactor(tvix/glue): create environment_vars Vec at the end r/7314
Prevent code in this function from accessing the Vec, realize it only when returning the BuildRequest struct. Change-Id: I385c1adca552c9cb261cd70c5ca3ec45f0d7a9c3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10521 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/glue')
-rw-r--r-- | tvix/glue/src/tvix_build.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tvix/glue/src/tvix_build.rs b/tvix/glue/src/tvix_build.rs index 85a9ba40ac16..399b451c4c71 100644 --- a/tvix/glue/src/tvix_build.rs +++ b/tvix/glue/src/tvix_build.rs @@ -83,13 +83,6 @@ where .map(|(k, v)| (k.clone(), Bytes::from(v.to_vec()))), ); - // Turn this into a sorted-by-key Vec<EnvVar>. - let environment_vars = Vec::from_iter( - environment_vars - .into_iter() - .map(|(k, v)| EnvVar { key: k, value: v }), - ); - // Produce inputs. As we refer to the contents here, not just plain store path strings, // we need to perform lookups. // FUTUREWORK: should we also model input_derivations and input_sources with StorePath? @@ -145,7 +138,13 @@ where BuildRequest { command_args, outputs: output_paths, - environment_vars, + + // Turn this into a sorted-by-key Vec<EnvVar>. + environment_vars: Vec::from_iter( + environment_vars + .into_iter() + .map(|(key, value)| EnvVar { key, value }), + ), inputs, inputs_dir: nix_compat::store_path::STORE_DIR.into(), constraints, |