about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-02-26T14·54+0300
committertazjin <tazjin@tvl.su>2023-03-04T15·18+0000
commita11a3e2c59345172e95d47fa5e7203acdf1110cb (patch)
tree9511ebec76236c51a35f95c1839deb31c39ba59e
parent1f9b5822391fa63b83f4224ba43ed404ded6dae8 (diff)
refactor(tvix/eval): implement From<Span> for LightSpan r/5883
This simplifies some code down the line.

Change-Id: I58dd71e796e11479f44516cf24932f8061843d23
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8139
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
-rw-r--r--tvix/eval/src/spans.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tvix/eval/src/spans.rs b/tvix/eval/src/spans.rs
index d2a8e9badf..c0130a6654 100644
--- a/tvix/eval/src/spans.rs
+++ b/tvix/eval/src/spans.rs
@@ -42,6 +42,12 @@ impl LightSpan {
     }
 }
 
+impl From<Span> for LightSpan {
+    fn from(span: Span) -> Self {
+        LightSpan::Actual { span }
+    }
+}
+
 /// Trait implemented by all types from which we can retrieve a span.
 pub trait ToSpan {
     fn span_for(&self, file: &File) -> Span;