Skip to content

Commit dc4b901

Browse files
committed
notifications: log directly when using download backends
1 parent 7365ab7 commit dc4b901

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/download/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ use anyhow::Context;
1515
use anyhow::anyhow;
1616
use sha2::Sha256;
1717
use thiserror::Error;
18+
#[cfg(any(
19+
feature = "curl-backend",
20+
feature = "reqwest-rustls-tls",
21+
feature = "reqwest-native-tls"
22+
))]
23+
use tracing::debug;
1824
#[cfg(any(feature = "reqwest-rustls-tls", feature = "reqwest-native-tls"))]
1925
use tracing::info;
2026
use tracing::warn;
@@ -209,12 +215,12 @@ async fn download_file_(
209215
Err(_) => 180,
210216
});
211217

212-
notify_handler(match backend {
218+
match backend {
213219
#[cfg(feature = "curl-backend")]
214-
Backend::Curl => Notification::UsingCurl,
220+
Backend::Curl => debug!("downloading with curl"),
215221
#[cfg(any(feature = "reqwest-rustls-tls", feature = "reqwest-native-tls"))]
216-
Backend::Reqwest(_) => Notification::UsingReqwest,
217-
});
222+
Backend::Reqwest(_) => debug!("downloading with reqwest"),
223+
};
218224

219225
let res = backend
220226
.download_to_path(url, path, resume_from_partial, Some(callback), timeout)

src/notifications.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ pub(crate) enum Notification<'a> {
4646
/// utils::notifications by the time tar unpacking is called.
4747
SetDefaultBufferSize(usize),
4848
Error(String),
49-
#[cfg(feature = "curl-backend")]
50-
UsingCurl,
51-
UsingReqwest,
5249
SetAutoInstall(&'a str),
5350
SetDefaultToolchain(Option<&'a ToolchainName>),
5451
SetOverrideToolchain(&'a Path, &'a str),
@@ -102,10 +99,7 @@ impl Notification<'_> {
10299
| DownloadDataReceived(_, _)
103100
| DownloadFinished(_)
104101
| DownloadFailed(_)
105-
| ResumingPartialDownload
106-
| UsingReqwest => NotificationLevel::Debug,
107-
#[cfg(feature = "curl-backend")]
108-
UsingCurl => NotificationLevel::Debug,
102+
| ResumingPartialDownload => NotificationLevel::Debug,
109103
Error(_) => NotificationLevel::Error,
110104
ToolchainDirectory(_)
111105
| LookingForToolchain(_)
@@ -224,9 +218,6 @@ impl Display for Notification<'_> {
224218
DownloadFinished(_) => write!(f, "download finished"),
225219
DownloadFailed(_) => write!(f, "download failed"),
226220
ResumingPartialDownload => write!(f, "resuming partial download"),
227-
#[cfg(feature = "curl-backend")]
228-
UsingCurl => write!(f, "downloading with curl"),
229-
UsingReqwest => write!(f, "downloading with reqwest"),
230221
SetAutoInstall(auto) => write!(f, "auto install set to '{auto}'"),
231222
SetDefaultToolchain(None) => write!(f, "default toolchain unset"),
232223
SetDefaultToolchain(Some(name)) => write!(f, "default toolchain set to '{name}'"),

0 commit comments

Comments
 (0)