Skip to content

Commit ed4ff46

Browse files
committed
notifications: log directly when setting the default toolchain
1 parent fa6b72b commit ed4ff46

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

src/config.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,12 @@ impl<'a> Cfg<'a> {
344344
s.default_toolchain = toolchain.map(|t| t.to_string());
345345
Ok(())
346346
})?;
347-
(self.notify_handler)(Notification::SetDefaultToolchain(toolchain));
347+
348+
match toolchain {
349+
Some(t) => info!(new = %t, "default toolchain set"),
350+
None => info!("default toolchain unset"),
351+
}
352+
348353
Ok(())
349354
}
350355

src/notifications.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub(crate) enum Notification<'a> {
2626
/// member, but the notification callback is already narrowed to
2727
/// utils::notifications by the time tar unpacking is called.
2828
SetDefaultBufferSize(usize),
29-
SetDefaultToolchain(Option<&'a ToolchainName>),
3029
SetOverrideToolchain(&'a Path, &'a str),
3130
SetProfile(&'a str),
3231
SetSelfUpdate(&'a str),
@@ -69,8 +68,7 @@ impl Notification<'_> {
6968
| ReadMetadataVersion(_)
7069
| InstalledToolchain(_)
7170
| UpdateHashMatches => NotificationLevel::Debug,
72-
SetDefaultToolchain(_)
73-
| SetOverrideToolchain(_, _)
71+
SetOverrideToolchain(_, _)
7472
| SetProfile(_)
7573
| SetSelfUpdate(_)
7674
| UsingExistingToolchain(_)
@@ -106,8 +104,6 @@ impl Display for Notification<'_> {
106104
DownloadDataReceived(data, _) => write!(f, "received some data of size {}", data.len()),
107105
DownloadFinished(_) => write!(f, "download finished"),
108106
DownloadFailed(_) => write!(f, "download failed"),
109-
SetDefaultToolchain(None) => write!(f, "default toolchain unset"),
110-
SetDefaultToolchain(Some(name)) => write!(f, "default toolchain set to '{name}'"),
111107
SetOverrideToolchain(path, name) => write!(
112108
f,
113109
"override toolchain for '{}' set to '{}'",

tests/suite/cli_exact.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ info: syncing channel updates toolchain=nightly-[HOST_TRIPLE]
2424
info: latest update updated=2015-01-02 version=1.3.0 (hash-nightly-2)
2525
info: downloading component[..]
2626
...
27-
info: default toolchain set to 'nightly-[HOST_TRIPLE]'
27+
info: default toolchain set new=nightly-[HOST_TRIPLE]
2828
2929
"#]]);
3030
cx.config
@@ -325,7 +325,7 @@ info: syncing channel updates toolchain=nightly-[HOST_TRIPLE]
325325
info: latest update updated=2015-01-02 version=1.3.0 (hash-nightly-2)
326326
info: downloading component[..]
327327
...
328-
info: default toolchain set to 'nightly-[HOST_TRIPLE]'
328+
info: default toolchain set new=nightly-[HOST_TRIPLE]
329329
330330
"#]]);
331331
cx.config

tests/suite/cli_rustup.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ info: syncing channel updates toolchain=nightly-[HOST_TRIPLE]
286286
info: latest update updated=2015-01-02 version=1.3.0 (hash-nightly-2)
287287
info: downloading component[..]
288288
...
289-
info: default toolchain set to 'nightly-[HOST_TRIPLE]'
289+
info: default toolchain set new=nightly-[HOST_TRIPLE]
290290
291291
"#]])
292292
.is_ok();
@@ -323,7 +323,7 @@ async fn default_override() {
323323
.await
324324
.with_stderr(snapbox::str![[r#"
325325
info: using existing install for 'stable-[HOST_TRIPLE]'
326-
info: default toolchain set to 'stable-[HOST_TRIPLE]'
326+
info: default toolchain set new=stable-[HOST_TRIPLE]
327327
info: note that the toolchain 'nightly-[HOST_TRIPLE]' is currently in use (directory override for '[..]')
328328
329329
"#]])
@@ -3721,7 +3721,7 @@ info: syncing channel updates toolchain=nightly-[HOST_TRIPLE]
37213721
info: latest update updated=2015-01-02 version=1.3.0 (hash-nightly-2)
37223722
info: downloading component[..]
37233723
...
3724-
info: default toolchain set to 'nightly-[HOST_TRIPLE]'
3724+
info: default toolchain set new=nightly-[HOST_TRIPLE]
37253725
37263726
"#]])
37273727
.is_ok();

tests/suite/cli_self_upd.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ info: syncing channel updates toolchain=stable-[HOST_TRIPLE]
7474
info: latest update updated=2015-01-02 version=1.1.0 (hash-stable-1.1.0)
7575
info: downloading component[..]
7676
...
77-
info: default toolchain set to 'stable-[HOST_TRIPLE]'
77+
info: default toolchain set new=stable-[HOST_TRIPLE]
7878
7979
"#]])
8080
.is_ok();
@@ -119,7 +119,7 @@ info: syncing channel updates toolchain=stable-[HOST_TRIPLE]
119119
info: latest update updated=2015-01-02 version=1.1.0 (hash-stable-1.1.0)
120120
info: downloading component[..]
121121
...
122-
info: default toolchain set to 'stable-[HOST_TRIPLE]'
122+
info: default toolchain set new=stable-[HOST_TRIPLE]
123123
...
124124
"#]])
125125
.is_ok();
@@ -899,7 +899,7 @@ async fn reinstall_specifying_different_toolchain() {
899899
.await
900900
.with_stderr(snapbox::str![[r#"
901901
...
902-
info: default toolchain set to 'nightly-[HOST_TRIPLE]'
902+
info: default toolchain set new=nightly-[HOST_TRIPLE]
903903
...
904904
"#]])
905905
.is_ok();

0 commit comments

Comments
 (0)