From bc9351f811a9394898d0c9ab4da193e320c27bdd Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 26 Aug 2022 18:35:37 +0300 Subject: refactor(tvix/eval): get rid of Value::Blackhole variant This is no longer needed for anything and the extra clone here is not really more costly than constructing a blackhole value in a different place. Change-Id: I5c63085b1b4418b629ea58a42e3bfe9a9b586d76 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6275 Reviewed-by: grfn Tested-by: BuildkiteCI --- tvix/eval/src/value/attrs.rs | 4 ++-- tvix/eval/src/value/mod.rs | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'tvix/eval/src/value') diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs index 51f741a210..74f1bd4481 100644 --- a/tvix/eval/src/value/attrs.rs +++ b/tvix/eval/src/value/attrs.rs @@ -315,8 +315,8 @@ fn attempt_optimise_kv(slice: &mut [Value]) -> Option { }; Some(NixAttrs(AttrsRep::KV { - name: std::mem::replace(&mut slice[name_idx], Value::Blackhole), - value: std::mem::replace(&mut slice[value_idx], Value::Blackhole), + name: slice[name_idx].clone(), + value: slice[value_idx].clone(), })) } diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index 6bd1efde52..3db6a00e4d 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -33,7 +33,6 @@ pub enum Value { // Internal values that, while they technically exist at runtime, // are never returned to or created directly by users. AttrPath(Vec), - Blackhole, NotFound, } @@ -55,7 +54,7 @@ impl Value { Value::Closure(_) | Value::Builtin(_) => "lambda", // Internal types - Value::AttrPath(_) | Value::Blackhole | Value::NotFound => "internal", + Value::AttrPath(_) | Value::NotFound => "internal", } } @@ -141,7 +140,6 @@ impl Display for Value { // internal types Value::AttrPath(path) => write!(f, "internal[attrpath({})]", path.len()), - Value::Blackhole => f.write_str("internal[blackhole]"), Value::NotFound => f.write_str("internal[not found]"), } } -- cgit 1.4.1