about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-03-10T11·19+0100
committerclbot <clbot@tvl.fyi>2023-03-10T12·13+0000
commit8e97c0deb056dfe29feff9aefcc524c0f2f36355 (patch)
tree43159b06b199b8e5a653472510aef1302331511a
parent510927e43a950e727c31e100f1e88f0d8a80b6b9 (diff)
refactor(tvix/store): impl Default for MemoryPathInfoService r/5940
Change-Id: I07f83f8aaa6312cc37ce7e7ee2b713e60df23782
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8234
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
-rw-r--r--tvix/store/src/pathinfoservice/memory.rs9
-rw-r--r--tvix/store/src/tests/utils.rs2
2 files changed, 2 insertions, 9 deletions
diff --git a/tvix/store/src/pathinfoservice/memory.rs b/tvix/store/src/pathinfoservice/memory.rs
index db31a2d771..4ac2188382 100644
--- a/tvix/store/src/pathinfoservice/memory.rs
+++ b/tvix/store/src/pathinfoservice/memory.rs
@@ -8,18 +8,11 @@ use nix_compat::store_path::DIGEST_SIZE;
 
 use super::PathInfoService;
 
+#[derive(Default)]
 pub struct MemoryPathInfoService {
     db: Arc<RwLock<HashMap<Vec<u8>, proto::PathInfo>>>,
 }
 
-impl MemoryPathInfoService {
-    pub fn new() -> Self {
-        let db = Arc::new(RwLock::new(HashMap::default()));
-
-        Self { db }
-    }
-}
-
 impl PathInfoService for MemoryPathInfoService {
     fn get(
         &self,
diff --git a/tvix/store/src/tests/utils.rs b/tvix/store/src/tests/utils.rs
index ac801b47aa..0b4a85a3af 100644
--- a/tvix/store/src/tests/utils.rs
+++ b/tvix/store/src/tests/utils.rs
@@ -18,5 +18,5 @@ pub fn gen_directory_service() -> impl DirectoryService + Send + Sync + Clone +
 }
 
 pub fn gen_pathinfo_service() -> impl PathInfoService {
-    MemoryPathInfoService::new()
+    MemoryPathInfoService::default()
 }