about summary refs log tree commit diff
path: root/tvix/eval/src
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src')
-rw-r--r--tvix/eval/src/builtins/mod.rs9
-rw-r--r--tvix/eval/src/compiler/mod.rs7
-rw-r--r--tvix/eval/src/eval.rs2
-rw-r--r--tvix/eval/src/opcode.rs1
-rw-r--r--tvix/eval/src/value/attrs.rs2
-rw-r--r--tvix/eval/src/value/builtin.rs2
6 files changed, 10 insertions, 13 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index 99a63c97998d..49f047543994 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -43,11 +43,10 @@ fn pure_builtins() -> Vec<Builtin> {
             Ok(Value::Bool(matches!(args[0], Value::Float(_))))
         }),
         Builtin::new("isFunction", 1, |args| {
-            Ok(Value::Bool(match args[0] {
-                Value::Closure(_) => true,
-                Value::Builtin(_) => true,
-                _ => false,
-            }))
+            Ok(Value::Bool(matches!(
+                args[0],
+                Value::Closure(_) | Value::Builtin(_)
+            )))
         }),
         Builtin::new("isInt", 1, |args| {
             Ok(Value::Bool(matches!(args[0], Value::Integer(_))))
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index 7b92b8a099c2..faf67135ed62 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -424,15 +424,14 @@ impl Compiler {
     fn compile_has_attr(&mut self, node: ast::HasAttr) {
         // Put the attribute set on the stack.
         self.compile(node.expr().unwrap());
-        let mut count = 0;
 
         // Push all path fragments with an operation for fetching the
         // next nested element, for all fragments except the last one.
-        for fragment in node.attrpath().unwrap().attrs() {
+        for (count, fragment) in node.attrpath().unwrap().attrs().enumerate() {
             if count > 0 {
                 self.chunk().push_op(OpCode::OpAttrOrNotFound);
             }
-            count += 1;
+
             self.compile_attr(fragment);
         }
 
@@ -950,7 +949,7 @@ impl Compiler {
 
         self.scope_mut().locals.push(Local {
             depth,
-            name: name.into(),
+            name,
             node: Some(node),
             phantom: false,
             used: false,
diff --git a/tvix/eval/src/eval.rs b/tvix/eval/src/eval.rs
index 2f4bd234573b..add621af6cc3 100644
--- a/tvix/eval/src/eval.rs
+++ b/tvix/eval/src/eval.rs
@@ -1,7 +1,5 @@
 use std::path::PathBuf;
 
-use rnix;
-
 use crate::{
     builtins::global_builtins,
     errors::{ErrorKind, EvalResult},
diff --git a/tvix/eval/src/opcode.rs b/tvix/eval/src/opcode.rs
index 39a32d3bad2b..2ad4aa1f9815 100644
--- a/tvix/eval/src/opcode.rs
+++ b/tvix/eval/src/opcode.rs
@@ -7,6 +7,7 @@ pub struct ConstantIdx(pub usize);
 #[derive(Clone, Copy, Debug)]
 pub struct CodeIdx(pub usize);
 
+#[allow(clippy::enum_variant_names)]
 #[warn(variant_size_differences)]
 #[derive(Clone, Copy, Debug)]
 pub enum OpCode {
diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs
index fffd316cbfa2..51f741a210a1 100644
--- a/tvix/eval/src/value/attrs.rs
+++ b/tvix/eval/src/value/attrs.rs
@@ -91,7 +91,7 @@ impl Display for NixAttrs {
             }
 
             AttrsRep::Map(map) => {
-                for (name, value) in map.iter() {
+                for (name, value) in map {
                     write!(f, "{} = {}; ", name.ident_str(), value)?;
                 }
             }
diff --git a/tvix/eval/src/value/builtin.rs b/tvix/eval/src/value/builtin.rs
index 84582e298586..e876c235557e 100644
--- a/tvix/eval/src/value/builtin.rs
+++ b/tvix/eval/src/value/builtin.rs
@@ -58,7 +58,7 @@ impl Builtin {
         }
 
         // Function is not yet ready to be called.
-        return Ok(Value::Builtin(self));
+        Ok(Value::Builtin(self))
     }
 }