about summary refs log tree commit diff
path: root/tvix/castore/src/directoryservice
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/castore/src/directoryservice')
-rw-r--r--tvix/castore/src/directoryservice/directory_graph.rs20
-rw-r--r--tvix/castore/src/directoryservice/tests/mod.rs21
2 files changed, 18 insertions, 23 deletions
diff --git a/tvix/castore/src/directoryservice/directory_graph.rs b/tvix/castore/src/directoryservice/directory_graph.rs
index d8d8e7370510..017cef024059 100644
--- a/tvix/castore/src/directoryservice/directory_graph.rs
+++ b/tvix/castore/src/directoryservice/directory_graph.rs
@@ -290,16 +290,16 @@ mod tests {
     use super::{DirectoryGraph, LeavesToRootValidator, RootToLeavesValidator};
 
     lazy_static! {
-        pub static ref BROKEN_PARENT_DIRECTORY: Directory = {
-            let mut dir = Directory::new();
-            dir.add(
-                "foo".try_into().unwrap(),
-                Node::Directory{
-                    digest: DIRECTORY_A.digest(),
-                    size: DIRECTORY_A.size() + 42, // wrong!
-                }).unwrap();
-            dir
-        };
+        pub static ref BROKEN_PARENT_DIRECTORY: Directory =
+            Directory::try_from_iter([
+                (
+                    "foo".try_into().unwrap(),
+                    Node::Directory{
+                        digest: DIRECTORY_A.digest(),
+                        size: DIRECTORY_A.size() + 42, // wrong!
+                    }
+                )
+            ]).unwrap();
     }
 
     #[rstest]
diff --git a/tvix/castore/src/directoryservice/tests/mod.rs b/tvix/castore/src/directoryservice/tests/mod.rs
index 01e42130456f..ad189564bfe7 100644
--- a/tvix/castore/src/directoryservice/tests/mod.rs
+++ b/tvix/castore/src/directoryservice/tests/mod.rs
@@ -216,19 +216,14 @@ async fn upload_reject_dangling_pointer(directory_service: impl DirectoryService
 #[apply(directory_services)]
 #[tokio::test]
 async fn upload_reject_wrong_size(directory_service: impl DirectoryService) {
-    let wrong_parent_directory = {
-        let mut dir = Directory::new();
-        dir.add(
-            "foo".try_into().unwrap(),
-            Node::Directory {
-                digest: DIRECTORY_A.digest(),
-                size: DIRECTORY_A.size() + 42, // wrong!
-            },
-        )
-        .unwrap();
-
-        dir
-    };
+    let wrong_parent_directory = Directory::try_from_iter([(
+        "foo".try_into().unwrap(),
+        Node::Directory {
+            digest: DIRECTORY_A.digest(),
+            size: DIRECTORY_A.size() + 42, // wrong!
+        },
+    )])
+    .unwrap();
 
     // Now upload both. Ensure it either fails during the second put, or during
     // the close.