about summary refs log tree commit diff
path: root/tvix/eval/src/vm.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-03T01·20+0300
committertazjin <tazjin@tvl.su>2022-09-08T20·17+0000
commit09eaa0d4ae63b0513c934535a40fa2aaa25846e1 (patch)
tree8070b85c5408b5f3d7073c025a322c27502fc581 /tvix/eval/src/vm.rs
parentfe047885d75a97bd303176847db7fdb2a781344d (diff)
fix(tvix/eval): address current clippy & grfn lints r/4763
Change-Id: I65c6feb9f817b5b367d37204a1f57acfe4100d97
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6430
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r--tvix/eval/src/vm.rs17
1 files changed, 4 insertions, 13 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index b2785c511798..5d26afe3f304 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -25,6 +25,7 @@ impl CallFrame {
     }
 }
 
+#[derive(Default)]
 pub struct VM {
     frames: Vec<CallFrame>,
     stack: Vec<Value>,
@@ -161,6 +162,7 @@ impl VM {
         }
     }
 
+    #[allow(clippy::let_and_return)] // due to disassembler
     /// Execute the given lambda in this VM's context, returning its
     /// value after its stack frame completes.
     pub fn call(
@@ -610,7 +612,7 @@ impl VM {
                 ..
             }) => match up {
                 Some(idx) => Ok(self.frame().upvalue(idx).clone()),
-                None => Ok(Value::DynamicUpvalueMissing(ident.into())),
+                None => Ok(Value::DynamicUpvalueMissing(ident)),
             },
 
             Err(err) => Err(err),
@@ -696,17 +698,6 @@ impl VM {
             _ => Ok(()),
         }
     }
-
-    pub fn new() -> Self {
-        VM {
-            frames: vec![],
-            stack: vec![],
-            with_stack: vec![],
-
-            #[cfg(feature = "disassembler")]
-            tracer: crate::disassembler::Tracer::new(),
-        }
-    }
 }
 
 // TODO: use Rc::unwrap_or_clone once it is stabilised.
@@ -716,7 +707,7 @@ fn unwrap_or_clone_rc<T: Clone>(rc: Rc<T>) -> T {
 }
 
 pub fn run_lambda(lambda: Lambda) -> EvalResult<Value> {
-    let mut vm = VM::new();
+    let mut vm = VM::default();
     let value = vm.call(Rc::new(lambda), vec![], 0)?;
     vm.force_for_output(&value)?;
     Ok(value)