refactor: reduce quality findings

This commit is contained in:
2026-06-28 15:42:12 +08:00
parent 02716d3ccd
commit 3c00659691
11 changed files with 189 additions and 135 deletions
+6 -6
View File
@@ -83,11 +83,13 @@ impl CasRepository for FileSystemCasRepository {
async fn get(&self, id: &ObjectId) -> bat_core::Result<Vec<u8>> {
let hash = Self::parse_object_id(id)?;
self.engine()
let data = self
.engine()
.await?
.get(&hash)
.await
.map_err(Self::map_error)
.map_err(Self::map_error)?;
Ok(data)
}
async fn exists(&self, id: &ObjectId) -> bool {
@@ -175,10 +177,8 @@ mod tests {
assert_eq!(repo.gc().await.unwrap(), 1);
assert!(!repo.exists(&id).await);
assert!(matches!(
repo.get(&id).await,
Err(bat_core::Error::NotFound(_))
));
let missing = repo.get(&id).await;
assert!(matches!(missing, Err(bat_core::Error::NotFound(_))));
}
#[tokio::test]