chore(tvix/store/pathinfosvc): clippy

Change-Id: Ied4bed08e989791f832922da8776d2104035e28a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8812
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-06-17 13:20:56 +03:00 committed by clbot
parent b10f008b03
commit ad687ccaf4
2 changed files with 8 additions and 11 deletions

View file

@ -27,9 +27,8 @@ pub fn from_addr(
blob_service: Arc<dyn BlobService>, blob_service: Arc<dyn BlobService>,
directory_service: Arc<dyn DirectoryService>, directory_service: Arc<dyn DirectoryService>,
) -> Result<Arc<dyn PathInfoService>, crate::Error> { ) -> Result<Arc<dyn PathInfoService>, crate::Error> {
let url = Url::parse(uri).map_err(|e| { let url = Url::parse(uri)
crate::Error::StorageError(format!("unable to parse url: {}", e.to_string())) .map_err(|e| crate::Error::StorageError(format!("unable to parse url: {}", e)))?;
})?;
Ok(if url.scheme() == "memory" { Ok(if url.scheme() == "memory" {
Arc::new(MemoryPathInfoService::from_url( Arc::new(MemoryPathInfoService::from_url(

View file

@ -74,15 +74,13 @@ impl PathInfoService for SledPathInfoService {
if url.path().is_empty() { if url.path().is_empty() {
Self::new_temporary(blob_service, directory_service) Self::new_temporary(blob_service, directory_service)
.map_err(|e| Error::StorageError(e.to_string())) .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 { } else {
if url.path() == "/" { Self::new(url.path().into(), blob_service, directory_service)
Err(crate::Error::StorageError( .map_err(|e| Error::StorageError(e.to_string()))
"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()))
}
} }
} }