Skip to content

Commit 0935568

Browse files
committed
Simplify logic for download backend notification
1 parent dc9d072 commit 0935568

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/utils/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ async fn download_file_(
252252
let use_rustls = process
253253
.var_os("RUSTUP_USE_RUSTLS")
254254
.is_none_or(|it| it != "0");
255-
let (backend, notification) = if use_curl_backend {
256-
(Backend::Curl, Notification::UsingCurl)
255+
let backend = if use_curl_backend {
256+
Backend::Curl
257257
} else {
258258
let tls_backend = if use_rustls {
259259
TlsBackend::Rustls
@@ -267,9 +267,14 @@ async fn download_file_(
267267
TlsBackend::Rustls
268268
}
269269
};
270-
(Backend::Reqwest(tls_backend), Notification::UsingReqwest)
270+
Backend::Reqwest(tls_backend)
271271
};
272-
notify_handler(notification);
272+
273+
notify_handler(match backend {
274+
Backend::Curl => Notification::UsingCurl,
275+
Backend::Reqwest(_) => Notification::UsingReqwest,
276+
});
277+
273278
let res =
274279
download_to_path_with_backend(backend, url, path, resume_from_partial, Some(callback))
275280
.await;

0 commit comments

Comments
 (0)