Skip to content

Commit 9702194

Browse files
committed
notifications: remove unused Display impl
1 parent df12b1b commit 9702194

File tree

3 files changed

+5
-34
lines changed

3 files changed

+5
-34
lines changed

src/dist/download.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl DownloadTracker {
254254
self.download_failed(url);
255255
debug!("download failed");
256256
}
257-
Notification::DownloadingComponent(component, _, _, url) => {
257+
Notification::DownloadingComponent(component, url) => {
258258
self.create_progress_bar(component.to_owned(), url.to_owned());
259259
}
260260
Notification::RetryingDownload(url) => {

src/dist/manifestation.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@ impl Manifestation {
182182
.notifier
183183
.handle(Notification::DownloadingComponent(
184184
&bin.component.short_name(new_manifest),
185-
&self.target_triple,
186-
bin.component.target.as_ref(),
187185
&bin.binary.url,
188186
));
189187
}
@@ -452,12 +450,9 @@ impl Manifestation {
452450
.unwrap()
453451
.replace(DEFAULT_DIST_SERVER, dl_cfg.tmp_cx.dist_server.as_str());
454452

455-
dl_cfg.notifier.handle(Notification::DownloadingComponent(
456-
"rust",
457-
&self.target_triple,
458-
Some(&self.target_triple),
459-
&url,
460-
));
453+
dl_cfg
454+
.notifier
455+
.handle(Notification::DownloadingComponent("rust", &url));
461456

462457
let dl = dl_cfg
463458
.download_and_check(&url, update_hash, ".tar.gz")

src/notifications.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
use std::fmt::{self, Display};
2-
3-
use crate::dist::TargetTriple;
4-
51
#[derive(Debug)]
62
pub(crate) enum Notification<'a> {
73
/// The URL of the download is passed as the last argument, to allow us to track concurrent downloads.
8-
DownloadingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>, &'a str),
4+
DownloadingComponent(&'a str, &'a str),
95
RetryingDownload(&'a str),
106
/// Received the Content-Length of the to-be downloaded data with
117
/// the respective URL of the download (for tracking concurrent downloads).
@@ -17,23 +13,3 @@ pub(crate) enum Notification<'a> {
1713
/// Download has failed.
1814
DownloadFailed(&'a str),
1915
}
20-
21-
impl Display for Notification<'_> {
22-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> {
23-
use self::Notification::*;
24-
match self {
25-
DownloadingComponent(c, h, t, _) => {
26-
if Some(h) == t.as_ref() || t.is_none() {
27-
write!(f, "downloading component '{c}'")
28-
} else {
29-
write!(f, "downloading component '{}' for '{}'", c, t.unwrap())
30-
}
31-
}
32-
RetryingDownload(url) => write!(f, "retrying download for '{url}'"),
33-
DownloadContentLengthReceived(len, _) => write!(f, "download size is: '{len}'"),
34-
DownloadDataReceived(data, _) => write!(f, "received some data of size {}", data.len()),
35-
DownloadFinished(_) => write!(f, "download finished"),
36-
DownloadFailed(_) => write!(f, "download failed"),
37-
}
38-
}
39-
}

0 commit comments

Comments
 (0)