mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-22 01:15:14 +08:00
refactor: reduce quality findings
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user