mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 19:31:35 +00:00
Use transpose in a couple places
This commit is contained in:
parent
cc75d2d882
commit
138499d47f
1 changed files with 9 additions and 15 deletions
|
@ -546,11 +546,9 @@ impl IdentifierRepo for SledRepo {
|
||||||
|
|
||||||
let opt = b!(self.identifier_details, identifier_details.get(key));
|
let opt = b!(self.identifier_details, identifier_details.get(key));
|
||||||
|
|
||||||
if let Some(ivec) = opt {
|
opt.map(|ivec| serde_json::from_slice(&ivec))
|
||||||
Ok(Some(serde_json::from_slice(&ivec)?))
|
.transpose()
|
||||||
} else {
|
.map_err(Error::from)
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(level = "trace", skip(self, identifier), fields(identifier = identifier.string_repr()))]
|
#[tracing::instrument(level = "trace", skip(self, identifier), fields(identifier = identifier.string_repr()))]
|
||||||
|
@ -682,11 +680,9 @@ impl HashRepo for SledRepo {
|
||||||
hash_variant_identifiers.get(key)
|
hash_variant_identifiers.get(key)
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(ivec) = opt {
|
opt.map(|ivec| I::from_bytes(ivec.to_vec()))
|
||||||
Ok(Some(I::from_bytes(ivec.to_vec())?))
|
.transpose()
|
||||||
} else {
|
.map_err(Error::from)
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self, hash), fields(hash = hex::encode(&hash)))]
|
#[tracing::instrument(skip(self, hash), fields(hash = hex::encode(&hash)))]
|
||||||
|
@ -759,11 +755,9 @@ impl HashRepo for SledRepo {
|
||||||
hash_motion_identifiers.get(hash)
|
hash_motion_identifiers.get(hash)
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(ivec) = opt {
|
opt.map(|ivec| I::from_bytes(ivec.to_vec()))
|
||||||
Ok(Some(I::from_bytes(ivec.to_vec())?))
|
.transpose()
|
||||||
} else {
|
.map_err(Error::from)
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self, hash), fields(hash = hex::encode(&hash)))]
|
#[tracing::instrument(skip(self, hash), fields(hash = hex::encode(&hash)))]
|
||||||
|
|
Loading…
Reference in a new issue