Skip to content

Commit 699a8a1

Browse files
committed
notifications: log directly on metadata upgrades that remove toolchains
1 parent c705ee4 commit 699a8a1

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/config.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use anyhow::{Context, Result, anyhow, bail};
88
use serde::Deserialize;
99
use thiserror::Error as ThisError;
1010
use tokio_stream::StreamExt;
11-
use tracing::{debug, error, info, trace};
11+
use tracing::{debug, error, info, trace, warn};
1212

1313
use crate::dist::AutoInstallMode;
1414
use crate::{
@@ -455,7 +455,9 @@ impl<'a> Cfg<'a> {
455455
match current_version {
456456
MetadataVersion::V2 => {
457457
// The toolchain installation format changed. Just delete them all.
458-
(self.notify_handler)(Notification::UpgradeRemovesToolchains);
458+
warn!(
459+
"this upgrade will remove all existing toolchains; you will need to reinstall them"
460+
);
459461

460462
let dirs = utils::read_dir("toolchains", &self.toolchains_dir)?;
461463
for dir in dirs {

src/notifications.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ pub(crate) enum Notification<'a> {
2525
/// member, but the notification callback is already narrowed to
2626
/// utils::notifications by the time tar unpacking is called.
2727
SetDefaultBufferSize(usize),
28-
UpgradeRemovesToolchains,
2928
/// Both `rust-toolchain` and `rust-toolchain.toml` exist within a directory
3029
DuplicateToolchainFile {
3130
rust_toolchain: &'a Path,
@@ -45,7 +44,7 @@ impl Notification<'_> {
4544
| DownloadDataReceived(_, _)
4645
| DownloadFinished(_)
4746
| DownloadFailed(_) => NotificationLevel::Debug,
48-
UpgradeRemovesToolchains | DuplicateToolchainFile { .. } => NotificationLevel::Warn,
47+
DuplicateToolchainFile { .. } => NotificationLevel::Warn,
4948
}
5049
}
5150
}
@@ -73,10 +72,6 @@ impl Display for Notification<'_> {
7372
DownloadDataReceived(data, _) => write!(f, "received some data of size {}", data.len()),
7473
DownloadFinished(_) => write!(f, "download finished"),
7574
DownloadFailed(_) => write!(f, "download failed"),
76-
UpgradeRemovesToolchains => write!(
77-
f,
78-
"this upgrade will remove all existing toolchains. you will need to reinstall them"
79-
),
8075
DuplicateToolchainFile {
8176
rust_toolchain,
8277
rust_toolchain_toml,

0 commit comments

Comments
 (0)