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-08-24T15·31+0300
committertazjin <tazjin@tvl.su>2022-09-02T13·36+0000
commitc3b13416b02d8e0e68330408b107d3aad29e3a3f (patch)
treeb5c11048eacd1f1af86798e4e885b5e114fcf6e8 /tvix/eval/src/vm.rs
parent86b21f9c330a6cb92bf62f26f7d066c75f1cefd6 (diff)
refactor(tvix/eval): add NixAttrs::contains function r/4597
This avoids copying around the value more than needed.

Change-Id: I35949d16dad7fb8f76e0f641eaccf48322144777
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6263
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r--tvix/eval/src/vm.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index b6d5a9838c3a..1e39792cd56f 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -242,7 +242,7 @@ impl VM {
                 OpCode::OpAttrsIsSet => {
                     let key = self.pop().to_string()?;
                     let result = match self.pop() {
-                        Value::Attrs(attrs) => attrs.select(key.as_str()).is_some(),
+                        Value::Attrs(attrs) => attrs.contains(key.as_str()),
 
                         // Nix allows use of `?` on non-set types, but
                         // always returns false in those cases.