refactor(tvix/eval): remove extra Rc<..> around Value::Attrs
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
This commit is contained in:
parent
91465dc78e
commit
86361f0f4a
5 changed files with 24 additions and 21 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue