diff options
author | Florian Klink <flokli@flokli.de> | 2024-10-21T13·43+0200 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-11-12T11·16+0000 |
commit | 2af30c8c7faf108bfcf649a9bf2818b25e5a63f6 (patch) | |
tree | 8acd2910068c82aee6bba2d0700f7e73082411eb /tvix/eval/src | |
parent | 1bc092b063766410bfac904ef621151f5b1ab6d2 (diff) |
refactor(tvix/eval): rm From<(T, Option<Box<NixContext>>)> for NixString r/8911
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>
Diffstat (limited to 'tvix/eval/src')
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 12 | ||||
-rw-r--r-- | tvix/eval/src/value/string/mod.rs | 9 |
2 files changed, 1 insertions, 20 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index 47c0f85b3c1b..0e5d1363fe8b 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -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")] diff --git a/tvix/eval/src/value/string/mod.rs b/tvix/eval/src/value/string/mod.rs index 5bcb4786b283..0f41ce9dc73c 100644 --- a/tvix/eval/src/value/string/mod.rs +++ b/tvix/eval/src/value/string/mod.rs @@ -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() |