about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tvix/eval/src/compiler.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/tvix/eval/src/compiler.rs b/tvix/eval/src/compiler.rs
index 7a27022d96de..0718f45ba777 100644
--- a/tvix/eval/src/compiler.rs
+++ b/tvix/eval/src/compiler.rs
@@ -135,10 +135,7 @@ impl Compiler {
                 Ok(())
             }
             ast::LiteralKind::Uri(u) => {
-                self.warnings.push(EvalWarning {
-                    node: node.syntax().clone(),
-                    kind: WarningKind::DeprecatedLiteralURL,
-                });
+                self.emit_warning(node.syntax().clone(), WarningKind::DeprecatedLiteralURL);
 
                 let idx = self
                     .chunk
@@ -610,10 +607,7 @@ impl Compiler {
                 // Within a `let` binding, inheriting from the outer
                 // scope is practically a no-op.
                 None => {
-                    self.warnings.push(EvalWarning {
-                        node: inherit.syntax().clone(),
-                        kind: WarningKind::UselessInherit,
-                    });
+                    self.emit_warning(inherit.syntax().clone(), WarningKind::UselessInherit);
 
                     continue;
                 }
@@ -827,6 +821,10 @@ impl Compiler {
 
         None
     }
+
+    fn emit_warning(&mut self, node: rnix::SyntaxNode, kind: WarningKind) {
+        self.warnings.push(EvalWarning { node, kind })
+    }
 }
 
 /// Convert a non-dynamic string expression to a string if possible,