Skip to content

Commit 98508fe

Browse files
committed
notifications: log directly when removing components
1 parent 79476a0 commit 98508fe

File tree

2 files changed

+25
-33
lines changed

2 files changed

+25
-33
lines changed

src/dist/manifestation.rs

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,31 @@ impl Manifestation {
218218

219219
// Uninstall components
220220
for component in &update.components_to_uninstall {
221-
let notification = if implicit_modify {
222-
Notification::RemovingOldComponent
223-
} else {
224-
Notification::RemovingComponent
225-
};
226-
(download_cfg.notify_handler)(notification(
227-
&component.short_name(new_manifest),
228-
&self.target_triple,
229-
component.target.as_ref(),
230-
));
221+
match (implicit_modify, &component.target) {
222+
(true, Some(t)) if t != &self.target_triple => {
223+
info!(
224+
"removing previous version of component {} for target {}",
225+
component.short_name(new_manifest),
226+
t
227+
);
228+
}
229+
(false, Some(t)) if t != &self.target_triple => {
230+
info!(
231+
"removing component {} for target {}",
232+
component.short_name(new_manifest),
233+
t
234+
);
235+
}
236+
(true, _) => {
237+
info!(
238+
"removing previous version of component {}",
239+
component.short_name(new_manifest),
240+
);
241+
}
242+
(false, _) => {
243+
info!("removing component {}", component.short_name(new_manifest));
244+
}
245+
}
231246

232247
tx = self.uninstall_component(component, new_manifest, tx, download_cfg.process)?;
233248
}

src/notifications.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ pub(crate) enum Notification<'a> {
1515
CachedFileChecksumFailed,
1616
/// The URL of the download is passed as the last argument, to allow us to track concurrent downloads.
1717
DownloadingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>, &'a str),
18-
RemovingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
19-
RemovingOldComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
2018
DownloadingManifest(&'a str),
2119
DownloadedManifest(&'a str, Option<&'a str>),
2220
DownloadingLegacyManifest,
@@ -70,8 +68,6 @@ impl Notification<'_> {
7068
match self {
7169
FileAlreadyDownloaded | DownloadingLegacyManifest => NotificationLevel::Debug,
7270
DownloadingComponent(_, _, _, _)
73-
| RemovingComponent(_, _, _)
74-
| RemovingOldComponent(_, _, _)
7571
| DownloadingManifest(_)
7672
| SkippingNightlyMissingComponent(_, _, _)
7773
| RetryingDownload(_)
@@ -121,25 +117,6 @@ impl Display for Notification<'_> {
121117
write!(f, "downloading component '{}' for '{}'", c, t.unwrap())
122118
}
123119
}
124-
RemovingComponent(c, h, t) => {
125-
if Some(h) == t.as_ref() || t.is_none() {
126-
write!(f, "removing component '{c}'")
127-
} else {
128-
write!(f, "removing component '{}' for '{}'", c, t.unwrap())
129-
}
130-
}
131-
RemovingOldComponent(c, h, t) => {
132-
if Some(h) == t.as_ref() || t.is_none() {
133-
write!(f, "removing previous version of component '{c}'")
134-
} else {
135-
write!(
136-
f,
137-
"removing previous version of component '{}' for '{}'",
138-
c,
139-
t.unwrap()
140-
)
141-
}
142-
}
143120
DownloadingManifest(t) => write!(f, "syncing channel updates for '{t}'"),
144121
DownloadedManifest(date, Some(version)) => {
145122
write!(f, "latest update on {date}, rust version {version}")

0 commit comments

Comments
 (0)