refactor(tvix/eval): Encapsulate Value::Attrs construction

Factor out the construction of Value::Attrs (including the Rc) into a
new `attrs` constructor function, to abstract away the presence of the
Rc itself.

Change-Id: I42fd4c3841e1db368db999ddd651277ff995f025
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6892
Autosubmit: grfn <grfn@gws.fyi>
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Griffin Smith 2022-10-08 13:33:33 -04:00 committed by grfn
parent f6bcd11cad
commit 278bccc1ea
4 changed files with 13 additions and 6 deletions

View file

@ -1,7 +1,7 @@
//! Support for configurable generation of arbitrary nix values
use proptest::{prelude::*, strategy::BoxedStrategy};
use std::{ffi::OsString, rc::Rc};
use std::ffi::OsString;
use super::{NixAttrs, NixList, NixString, Value};
@ -70,7 +70,7 @@ fn non_internal_value() -> impl Strategy<Value = Value> {
Default::default(),
Parameters::Strategy(inner.clone())
))
.prop_map(|a| Value::Attrs(Rc::new(a))),
.prop_map(Value::attrs),
any_with::<NixList>((Default::default(), Parameters::Strategy(inner)))
.prop_map(Value::List)
]