From ad687ccaf49f6cfd3b23083ddd543a840c2212ae Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 17 Jun 2023 13:20:56 +0300 Subject: chore(tvix/store/pathinfosvc): clippy Change-Id: Ied4bed08e989791f832922da8776d2104035e28a Reviewed-on: https://cl.tvl.fyi/c/depot/+/8812 Reviewed-by: tazjin Autosubmit: flokli Tested-by: BuildkiteCI --- tvix/store/src/pathinfoservice/from_addr.rs | 5 ++--- tvix/store/src/pathinfoservice/sled.rs | 14 ++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'tvix/store/src/pathinfoservice') diff --git a/tvix/store/src/pathinfoservice/from_addr.rs b/tvix/store/src/pathinfoservice/from_addr.rs index 2f712f4514..36b30aecdc 100644 --- a/tvix/store/src/pathinfoservice/from_addr.rs +++ b/tvix/store/src/pathinfoservice/from_addr.rs @@ -27,9 +27,8 @@ pub fn from_addr( blob_service: Arc, directory_service: Arc, ) -> Result, 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(MemoryPathInfoService::from_url( diff --git a/tvix/store/src/pathinfoservice/sled.rs b/tvix/store/src/pathinfoservice/sled.rs index 48db6b8b5c..3e5811b1d6 100644 --- a/tvix/store/src/pathinfoservice/sled.rs +++ b/tvix/store/src/pathinfoservice/sled.rs @@ -74,15 +74,13 @@ impl PathInfoService for SledPathInfoService { if url.path().is_empty() { Self::new_temporary(blob_service, directory_service) .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(), blob_service, directory_service) - .map_err(|e| Error::StorageError(e.to_string())) - } + Self::new(url.path().into(), blob_service, directory_service) + .map_err(|e| Error::StorageError(e.to_string())) } } -- cgit 1.4.1