feat(tvix/eval): rm NixContext::join, add take_context & IntoIterator

In places where we want to extend context with that from another
NixString, use take_context() to split it off, then call .extend(),
making use of IntoIterator to avoid a bunch of clones.

Change-Id: I2460141a3ed776c64c36132b2203b6a1d710b922
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11705
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: edef <edef@edef.eu>
This commit is contained in:
Florian Klink 2024-05-23 15:10:32 +02:00 committed by clbot
parent ec8d79f3db
commit 649a862ae1
6 changed files with 57 additions and 60 deletions

View file

@ -47,8 +47,8 @@ impl Value {
for val in l.into_iter() {
match generators::request_to_json(co, val).await {
Ok((v, mut ctx)) => {
context = context.join(&mut ctx);
Ok((v, ctx)) => {
context.extend(ctx.into_iter());
out.push(v)
}
Err(cek) => return Ok(Err(cek)),
@ -100,8 +100,8 @@ impl Value {
out.insert(
name.to_str()?.to_owned(),
match generators::request_to_json(co, value).await {
Ok((v, mut ctx)) => {
context = context.join(&mut ctx);
Ok((v, ctx)) => {
context.extend(ctx.into_iter());
v
}
Err(cek) => return Ok(Err(cek)),