refactor(tvix/eval): rm From<(T, Option<Box<NixContext>>)> for NixString

This conversion was a bit too magic, and we can just use
`NixString::new_context_from` without having to worry about the
distinction between an empty context or no context, as
NixString::new_context_from already deals with that internally.

Change-Id: I3e5d57ecfa0f7456aa6c526863e49f2523afaec3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12754
Tested-by: BuildkiteCI
Reviewed-by: edef <edef@edef.eu>
Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2024-10-21 15:43:43 +02:00 committed by flokli
parent 1bc092b063
commit 2af30c8c7f
2 changed files with 1 additions and 20 deletions

View file

@ -1498,17 +1498,7 @@ mod pure_builtins {
let mut buf: Vec<u8> = vec![];
let context = to_xml::value_to_xml(&mut buf, &value)?;
Ok((
buf,
// FUTUREWORK: We have a distinction between an empty context, and
// no context at all. Fix this.
if !context.is_empty() {
Some(Box::new(context))
} else {
None
},
)
.into())
Ok(NixString::new_context_from(context, buf).into())
}
#[builtin("trace")]

View file

@ -455,15 +455,6 @@ impl From<String> for NixString {
}
}
impl<T> From<(T, Option<Box<NixContext>>)> for NixString
where
NixString: From<T>,
{
fn from((s, ctx): (T, Option<Box<NixContext>>)) -> Self {
Self::new(NixString::from(s).as_ref(), ctx)
}
}
impl From<Box<str>> for NixString {
fn from(s: Box<str>) -> Self {
s.into_boxed_bytes().into()