feat(tvix/eval): Continue removing leakage of BTreeMap.
Fixes b/212. Based on feedback in https://cl.tvl.fyi/c/depot/+/7492, all uses of `NixAttrs::from_map` have been removed. Only `from_iter` and `from_kv` remain. Change-Id: I52e25f73018c2aa1843197427516b7a852503e2c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7500 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: IslandUsurper <lyle@menteeth.us>
This commit is contained in:
parent
9fed61297a
commit
f4e17caae8
4 changed files with 40 additions and 52 deletions
|
|
@ -345,14 +345,6 @@ impl NixAttrs {
|
|||
Ok(attrs)
|
||||
}
|
||||
|
||||
/// Construct an attribute set directly from a BTreeMap
|
||||
/// representation. This is only visible inside of the crate, as
|
||||
/// it is intended exclusively for use with the construction of
|
||||
/// global sets for the compiler.
|
||||
pub(crate) fn from_map(map: BTreeMap<NixString, Value>) -> Self {
|
||||
NixAttrs(AttrsRep::Map(map))
|
||||
}
|
||||
|
||||
/// Construct an optimized "KV"-style attribute set given the value for the
|
||||
/// `"name"` key, and the value for the `"value"` key
|
||||
pub(crate) fn from_kv(name: Value, value: Value) -> Self {
|
||||
|
|
|
|||
|
|
@ -526,10 +526,11 @@ impl TryFrom<serde_json::Value> for Value {
|
|||
name.clone().try_into()?,
|
||||
value.clone().try_into()?,
|
||||
))),
|
||||
_ => Ok(Self::attrs(NixAttrs::from_map(
|
||||
_ => Ok(Self::attrs(NixAttrs::from_iter(
|
||||
obj.into_iter()
|
||||
.map(|(k, v)| Ok((k.into(), v.try_into()?)))
|
||||
.collect::<Result<_, ErrorKind>>()?,
|
||||
.collect::<Result<Vec<(NixString, Value)>, ErrorKind>>()?
|
||||
.into_iter(),
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue