refactor(tvix/castore/blobsvc): inline things a bit

Get rid of the `let grpc_client` and `let resp` in some cases.

Change-Id: Idc1c0f566a3b1b48da62e6f1977b07620656b16c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11884
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
This commit is contained in:
Florian Klink 2024-06-27 00:54:09 +03:00 committed by flokli
parent 10c7701ac1
commit d0ef6a50df

View file

@ -45,15 +45,15 @@ where
{ {
#[instrument(skip(self, digest), fields(blob.digest=%digest))] #[instrument(skip(self, digest), fields(blob.digest=%digest))]
async fn has(&self, digest: &B3Digest) -> io::Result<bool> { async fn has(&self, digest: &B3Digest) -> io::Result<bool> {
let mut grpc_client = self.grpc_client.clone(); match self
let resp = grpc_client .grpc_client
.clone()
.stat(proto::StatBlobRequest { .stat(proto::StatBlobRequest {
digest: digest.clone().into(), digest: digest.clone().into(),
..Default::default() ..Default::default()
}) })
.await; .await
{
match resp {
Ok(_blob_meta) => Ok(true), Ok(_blob_meta) => Ok(true),
Err(e) if e.code() == Code::NotFound => Ok(false), Err(e) if e.code() == Code::NotFound => Ok(false),
Err(e) => Err(io::Error::new(io::ErrorKind::Other, e)), Err(e) => Err(io::Error::new(io::ErrorKind::Other, e)),