about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tvix/store/src/directoryservice/from_addr.rs5
-rw-r--r--tvix/store/src/directoryservice/sled.rs12
2 files changed, 7 insertions, 10 deletions
diff --git a/tvix/store/src/directoryservice/from_addr.rs b/tvix/store/src/directoryservice/from_addr.rs
index a3e2521e98e0..776cf061096c 100644
--- a/tvix/store/src/directoryservice/from_addr.rs
+++ b/tvix/store/src/directoryservice/from_addr.rs
@@ -18,9 +18,8 @@ use super::{DirectoryService, GRPCDirectoryService, MemoryDirectoryService, Sled
 /// - `grpc+http://host:port`, `grpc+https://host:port`
 ///    Connects to a (remote) tvix-store gRPC service.
 pub fn from_addr(uri: &str) -> Result<Arc<dyn DirectoryService>, crate::Error> {
-    let url = Url::parse(uri).map_err(|e| {
-        crate::Error::StorageError(format!("unable to parse url: {}", e.to_string()))
-    })?;
+    let url = Url::parse(uri)
+        .map_err(|e| crate::Error::StorageError(format!("unable to parse url: {}", e)))?;
 
     Ok(if url.scheme() == "memory" {
         Arc::new(MemoryDirectoryService::from_url(&url)?)
diff --git a/tvix/store/src/directoryservice/sled.rs b/tvix/store/src/directoryservice/sled.rs
index 6dc09ed646c3..e741434eabb5 100644
--- a/tvix/store/src/directoryservice/sled.rs
+++ b/tvix/store/src/directoryservice/sled.rs
@@ -49,14 +49,12 @@ impl DirectoryService for SledDirectoryService {
         // TODO: expose compression and other parameters as URL parameters, drop new and new_temporary?
         if url.path().is_empty() {
             Self::new_temporary().map_err(|e| Error::StorageError(e.to_string()))
+        } else if url.path() == "/" {
+            Err(crate::Error::StorageError(
+                "cowardly refusing to open / with sled".to_string(),
+            ))
         } else {
-            if url.path() == "/" {
-                Err(crate::Error::StorageError(
-                    "cowardly refusing to open / with sled".to_string(),
-                ))
-            } else {
-                Self::new(url.path().into()).map_err(|e| Error::StorageError(e.to_string()))
-            }
+            Self::new(url.path().into()).map_err(|e| Error::StorageError(e.to_string()))
         }
     }