about summary refs log tree commit diff
path: root/tvix/eval/src/lib.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-12-29T14·34+0300
committertazjin <tazjin@tvl.su>2022-12-29T17·44+0000
commit86361f0f4a754370b42ae3568ece4bc43850f36b (patch)
treecfbef4d124f2e21b760a9dacaaa03b454d322e27 /tvix/eval/src/lib.rs
parent91465dc78ec7b4a8c9b651657bb8ad5f25c556a7 (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/lib.rs')
-rw-r--r--tvix/eval/src/lib.rs7
1 files changed, 0 insertions, 7 deletions
diff --git a/tvix/eval/src/lib.rs b/tvix/eval/src/lib.rs
index 32624b2918a2..a467a1884c41 100644
--- a/tvix/eval/src/lib.rs
+++ b/tvix/eval/src/lib.rs
@@ -37,7 +37,6 @@ mod test_utils;
 mod tests;
 
 use std::path::PathBuf;
-use std::rc::Rc;
 use std::str::FromStr;
 use std::sync::Arc;
 
@@ -63,12 +62,6 @@ pub mod internal {
     pub use crate::vm::VM;
 }
 
-// TODO: use Rc::unwrap_or_clone once it is stabilised.
-// https://doc.rust-lang.org/std/rc/struct.Rc.html#method.unwrap_or_clone
-pub(crate) fn unwrap_or_clone_rc<T: Clone>(rc: Rc<T>) -> T {
-    Rc::try_unwrap(rc).unwrap_or_else(|rc| (*rc).clone())
-}
-
 /// An `Evaluation` represents how a piece of Nix code is evaluated. It can be
 /// instantiated and configured directly, or it can be accessed through the
 /// various simplified helper methods available below.