Skip to content

Commit 48682ab

Browse files
imageproxy: kill some turbofish
It's always nicer to directly hint the return type or let it be inferred by its surroundings. There's only one case where we need to be a bit more explicit about it, and even this explicitness is nicer. Signed-off-by: Allison Karlitskaya <[email protected]>
1 parent fd2a982 commit 48682ab

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/imageproxy.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ impl ImageProxy {
426426
};
427427

428428
// Verify semantic version
429-
let protover = r.impl_request::<String>("Initialize", [(); 0]).await?.0;
429+
let protover: String = r.impl_request("Initialize", [(); 0]).await?.0;
430430
tracing::debug!("Remote protocol version: {protover}");
431431
let protover = semver::Version::parse(protover.as_str())?;
432432
// Previously we had a feature to opt-in to requiring newer versions using `if cfg!()`.
@@ -523,18 +523,14 @@ impl ImageProxy {
523523
#[instrument]
524524
pub async fn open_image(&self, imgref: &str) -> Result<OpenedImage> {
525525
tracing::debug!("opening image");
526-
let (imgid, _) = self
527-
.impl_request::<u32>("OpenImage", [imgref])
528-
.await?;
526+
let (imgid, _): (u32, _) = self.impl_request("OpenImage", [imgref]).await?;
529527
Ok(OpenedImage(imgid))
530528
}
531529

532530
#[instrument]
533531
pub async fn open_image_optional(&self, imgref: &str) -> Result<Option<OpenedImage>> {
534532
tracing::debug!("opening image");
535-
let (imgid, _) = self
536-
.impl_request::<u32>("OpenImageOptional", [imgref])
537-
.await?;
533+
let (imgid, _): (u32, _) = self.impl_request("OpenImageOptional", [imgref]).await?;
538534
if imgid == 0 {
539535
Ok(None)
540536
} else {
@@ -586,9 +582,7 @@ impl ImageProxy {
586582
/// Fetch the config.
587583
/// For more information on OCI config, see <https://github.com/opencontainers/image-spec/blob/main/config.md>
588584
pub async fn fetch_config_raw(&self, img: &OpenedImage) -> Result<Vec<u8>> {
589-
let (_, fd) = self
590-
.impl_request::<()>("GetFullConfig", [img.0])
591-
.await?;
585+
let ((), fd) = self.impl_request("GetFullConfig", [img.0]).await?;
592586
self.read_all_fd(fd).await
593587
}
594588

@@ -626,7 +620,7 @@ impl ImageProxy {
626620
tracing::debug!("fetching blob");
627621
let args: Vec<serde_json::Value> =
628622
vec![img.0.into(), digest.to_string().into(), size.into()];
629-
let (_bloblen, fd) = self.impl_request::<i64>("GetBlob", args).await?;
623+
let (_bloblen, fd): (u64, _) = self.impl_request("GetBlob", args).await?;
630624
let fd = fd.ok_or_else(|| Error::Other("Missing fd from reply".into()))?;
631625
let FileDescriptors::FinishPipe { pipeid, datafd } = fd else {
632626
return Err(Error::Other("got dualfds, expecting FinishPipe fd".into()));
@@ -678,7 +672,7 @@ impl ImageProxy {
678672
)> {
679673
tracing::debug!("fetching blob");
680674
let args: Vec<serde_json::Value> = vec![img.0.into(), digest.to_string().into()];
681-
let (bloblen, fd) = self.impl_request::<u64>("GetRawBlob", args).await?;
675+
let (bloblen, fd): (u64, _) = self.impl_request("GetRawBlob", args).await?;
682676
let fd = fd.ok_or_else(|| Error::new_other("Missing fd from reply"))?;
683677
let FileDescriptors::DualFds { datafd, errfd } = fd else {
684678
return Err(Error::Other("got single fd, expecting dual fds".into()));
@@ -710,9 +704,7 @@ impl ImageProxy {
710704
) -> Result<Option<Vec<ConvertedLayerInfo>>> {
711705
tracing::debug!("Getting layer info");
712706
if layer_info_piped_proto_version().matches(&self.protover) {
713-
let (_, fd) = self
714-
.impl_request::<()>("GetLayerInfoPiped", [img.0])
715-
.await?;
707+
let ((), fd) = self.impl_request("GetLayerInfoPiped", [img.0]).await?;
716708
let buf = self.read_all_fd(fd).await?;
717709
return Ok(Some(serde_json::from_slice(&buf)?));
718710
}

0 commit comments

Comments
 (0)