Skip to content

Commit 7f6718c

Browse files
allisonkarlitskayacgwalters
authored andcommitted
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]> Signed-off-by: Colin Walters <[email protected]>
1 parent 3a0612f commit 7f6718c

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

src/imageproxy.rs

Lines changed: 8 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!()`.
@@ -524,18 +524,14 @@ impl ImageProxy {
524524
#[instrument]
525525
pub async fn open_image(&self, imgref: &str) -> Result<OpenedImage> {
526526
tracing::debug!("opening image");
527-
let (imgid, _) = self
528-
.impl_request::<u32>("OpenImage", [imgref])
529-
.await?;
527+
let (imgid, _) = self.impl_request("OpenImage", [imgref]).await?;
530528
Ok(OpenedImage(imgid))
531529
}
532530

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

@@ -627,7 +621,8 @@ impl ImageProxy {
627621
tracing::debug!("fetching blob");
628622
let args: Vec<serde_json::Value> =
629623
vec![img.0.into(), digest.to_string().into(), size.into()];
630-
let (_bloblen, fd) = self.impl_request::<i64>("GetBlob", args).await?;
624+
let (bloblen, fd) = self.impl_request("GetBlob", args).await?;
625+
let _: u64 = bloblen;
631626
let fd = fd.ok_or_else(|| Error::Other("Missing fd from reply".into()))?;
632627
let FileDescriptors::FinishPipe { pipeid, datafd } = fd else {
633628
return Err(Error::Other("got dualfds, expecting FinishPipe fd".into()));
@@ -679,7 +674,7 @@ impl ImageProxy {
679674
)> {
680675
tracing::debug!("fetching blob");
681676
let args: Vec<serde_json::Value> = vec![img.0.into(), digest.to_string().into()];
682-
let (bloblen, fd) = self.impl_request::<u64>("GetRawBlob", args).await?;
677+
let (bloblen, fd) = self.impl_request("GetRawBlob", args).await?;
683678
let fd = fd.ok_or_else(|| Error::new_other("Missing fd from reply"))?;
684679
let FileDescriptors::DualFds { datafd, errfd } = fd else {
685680
return Err(Error::Other("got single fd, expecting dual fds".into()));
@@ -711,9 +706,7 @@ impl ImageProxy {
711706
) -> Result<Option<Vec<ConvertedLayerInfo>>> {
712707
tracing::debug!("Getting layer info");
713708
if layer_info_piped_proto_version().matches(&self.protover) {
714-
let (_, fd) = self
715-
.impl_request::<()>("GetLayerInfoPiped", [img.0])
716-
.await?;
709+
let ((), fd) = self.impl_request("GetLayerInfoPiped", [img.0]).await?;
717710
let buf = self.read_all_fd(fd).await?;
718711
return Ok(Some(serde_json::from_slice(&buf)?));
719712
}

0 commit comments

Comments
 (0)