diff options
author | Vincent Ambo <mail@tazj.in> | 2022-12-29T14·34+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-12-29T17·44+0000 |
commit | 86361f0f4a754370b42ae3568ece4bc43850f36b (patch) | |
tree | cfbef4d124f2e21b760a9dacaaa03b454d322e27 /tvix/eval/src/value/mod.rs | |
parent | 91465dc78ec7b4a8c9b651657bb8ad5f25c556a7 (diff) |
refactor(tvix/eval): remove extra Rc<..> around Value::Attrs r/5542
The `im::OrdMap` is already small and cheap to copy while sharing memory, so this is not required anymore. Only the `KV` variant may have slightly larger content, but in practice this doesn't seem to make a difference when comparing the two variants and this one is less complicated. Change-Id: I64a563b209a2444125653777551373cb2989ca7d Reviewed-on: https://cl.tvl.fyi/c/depot/+/7677 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/value/mod.rs')
-rw-r--r-- | tvix/eval/src/value/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index 7791a4a8c33d..b5585923a301 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -39,7 +39,7 @@ pub enum Value { Float(f64), String(NixString), Path(PathBuf), - Attrs(Rc<NixAttrs>), + Attrs(Box<NixAttrs>), List(NixList), Closure(Rc<Closure>), // must use Rc<Closure> here in order to get proper pointer equality Builtin(Builtin), @@ -154,7 +154,7 @@ where impl Value { /// Construct a [`Value::Attrs`] from a [`NixAttrs`]. pub fn attrs(attrs: NixAttrs) -> Self { - Self::Attrs(Rc::new(attrs)) + Self::Attrs(Box::new(attrs)) } } @@ -303,7 +303,7 @@ impl Value { gen_cast!(as_int, i64, "int", Value::Integer(x), *x); gen_cast!(as_float, f64, "float", Value::Float(x), *x); gen_cast!(to_str, NixString, "string", Value::String(s), s.clone()); - gen_cast!(to_attrs, Rc<NixAttrs>, "set", Value::Attrs(a), a.clone()); + gen_cast!(to_attrs, Box<NixAttrs>, "set", Value::Attrs(a), a.clone()); gen_cast!(to_list, NixList, "list", Value::List(l), l.clone()); gen_cast!( as_closure, |