From 74a6e137bed7f566ee5afef82be584a187f31680 Mon Sep 17 00:00:00 2001 From: Jiahao XU <Jiahao_XU@outlook.com> Date: Tue, 21 Jun 2022 13:47:00 +1000 Subject: [PATCH] Refactor: Mv `debug!` into `create_request` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> --- src/helpers.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/helpers.rs b/src/helpers.rs index b2d252e9..55aee08c 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -52,6 +52,8 @@ pub async fn remote_exists(url: Url, method: Method) -> Result<bool, BinstallErr async fn create_request( url: Url, ) -> Result<impl Stream<Item = reqwest::Result<Bytes>>, BinstallError> { + debug!("Downloading from: '{url}'"); + reqwest::get(url.clone()) .await .and_then(|r| r.error_for_status()) @@ -69,8 +71,6 @@ pub async fn download_and_extract<P: AsRef<Path>>( fmt: PkgFmt, path: P, ) -> Result<(), BinstallError> { - debug!("Downloading from: '{url}'"); - let stream = create_request(url).await?; let path = path.as_ref(); @@ -97,8 +97,6 @@ pub async fn download_tar_based_and_visit<V: TarEntriesVisitor + Debug + Send + fmt: TarBasedFmt, visitor: V, ) -> Result<V, BinstallError> { - debug!("Downloading from: '{url}'"); - let stream = create_request(url).await?; debug!("Downloading and extracting then in-memory processing");