Skip to content

Commit 8c16b13

Browse files
committed
notifications: log directly when component is already installed
1 parent 7818bae commit 8c16b13

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

src/dist/manifestation.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,7 @@ impl Manifestation {
122122

123123
// Create the lists of components needed for installation
124124
let config = self.read_config()?;
125-
let mut update = Update::build_update(
126-
self,
127-
new_manifest,
128-
&changes,
129-
&config,
130-
&download_cfg.notify_handler,
131-
)?;
125+
let mut update = Update::build_update(self, new_manifest, &changes, &config)?;
132126

133127
if update.nothing_changes() {
134128
return Ok(UpdateStatus::Unchanged);
@@ -539,7 +533,6 @@ impl Update {
539533
new_manifest: &Manifest,
540534
changes: &Changes,
541535
config: &Option<Config>,
542-
notify_handler: &dyn Fn(Notification<'_>),
543536
) -> Result<Self> {
544537
// The package to install.
545538
let rust_package = new_manifest.get_package("rust")?;
@@ -601,9 +594,17 @@ impl Update {
601594
if !starting_list.contains(component) {
602595
result.components_to_install.push(component.clone());
603596
} else if changes.explicit_add_components.contains(component) {
604-
notify_handler(Notification::ComponentAlreadyInstalled(
605-
&component.description(new_manifest),
606-
));
597+
match &component.target {
598+
Some(t) if t != &manifestation.target_triple => info!(
599+
"component {} for target {} is up to date",
600+
component.short_name(new_manifest),
601+
t,
602+
),
603+
_ => info!(
604+
"component {} is up to date",
605+
component.short_name(new_manifest)
606+
),
607+
}
607608
}
608609
}
609610
} else {

src/notifications.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use crate::{dist::ToolchainDesc, toolchain::ToolchainName, utils::notify::Notifi
1111

1212
#[derive(Debug)]
1313
pub(crate) enum Notification<'a> {
14-
ComponentAlreadyInstalled(&'a str),
1514
CantReadUpdateHash(&'a Path),
1615
NoUpdateHash(&'a Path),
1716
FileAlreadyDownloaded,
@@ -81,7 +80,6 @@ impl Notification<'_> {
8180
| InstallingComponent(_, _, _)
8281
| RemovingComponent(_, _, _)
8382
| RemovingOldComponent(_, _, _)
84-
| ComponentAlreadyInstalled(_)
8583
| DownloadingManifest(_)
8684
| SkippingNightlyMissingComponent(_, _, _)
8785
| RetryingDownload(_)
@@ -125,7 +123,6 @@ impl Display for Notification<'_> {
125123
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> {
126124
use self::Notification::*;
127125
match self {
128-
ComponentAlreadyInstalled(c) => write!(f, "component {c} is up to date"),
129126
CantReadUpdateHash(path) => write!(
130127
f,
131128
"can't read update hash file: '{}', can't skip update...",

tests/suite/cli_v2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ async fn add_target_again() {
16301630
.expect(["rustup", "target", "add", CROSS_ARCH1])
16311631
.await
16321632
.with_stderr(snapbox::str![[r#"
1633-
info: component 'rust-std' for target '[CROSS_ARCH_I]' is up to date
1633+
info: component rust-std for target [CROSS_ARCH_I] is up to date
16341634
16351635
"#]])
16361636
.is_ok();
@@ -2563,7 +2563,7 @@ async fn regression_2601() {
25632563
.expect(["rustup", "component", "add", "rust-src"])
25642564
.await
25652565
.with_stderr(snapbox::str![[r#"
2566-
info: component 'rust-src' is up to date
2566+
info: component rust-src is up to date
25672567
25682568
"#]])
25692569
.is_ok();

0 commit comments

Comments
 (0)