Skip to content

Commit 927c120

Browse files
committed
notifications: log directly when setting overrides
1 parent 0b45a42 commit 927c120

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ impl<'a> Cfg<'a> {
919919
/// Create an override for a toolchain
920920
pub(crate) fn make_override(&self, path: &Path, toolchain: &ToolchainName) -> Result<()> {
921921
self.settings_file.with_mut(|s| {
922-
s.add_override(path, toolchain.to_string(), self.notify_handler.as_ref());
922+
s.add_override(path, toolchain.to_string());
923923
Ok(())
924924
})
925925
}

src/notifications.rs

Lines changed: 1 addition & 9 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-
SetOverrideToolchain(&'a Path, &'a str),
3029
SetProfile(&'a str),
3130
SetSelfUpdate(&'a str),
3231
LookingForToolchain(&'a ToolchainDesc),
@@ -68,8 +67,7 @@ impl Notification<'_> {
6867
| ReadMetadataVersion(_)
6968
| InstalledToolchain(_)
7069
| UpdateHashMatches => NotificationLevel::Debug,
71-
SetOverrideToolchain(_, _)
72-
| SetProfile(_)
70+
SetProfile(_)
7371
| SetSelfUpdate(_)
7472
| UsingExistingToolchain(_)
7573
| UninstallingToolchain(_)
@@ -104,12 +102,6 @@ impl Display for Notification<'_> {
104102
DownloadDataReceived(data, _) => write!(f, "received some data of size {}", data.len()),
105103
DownloadFinished(_) => write!(f, "download finished"),
106104
DownloadFailed(_) => write!(f, "download failed"),
107-
SetOverrideToolchain(path, name) => write!(
108-
f,
109-
"override toolchain for '{}' set to '{}'",
110-
path.display(),
111-
name
112-
),
113105
SetProfile(name) => write!(f, "profile set to '{name}'"),
114106
SetSelfUpdate(mode) => write!(f, "auto-self-update mode set to '{mode}'"),
115107
LookingForToolchain(name) => write!(f, "looking for installed toolchain '{name}'"),

src/settings.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use std::str::FromStr;
66

77
use anyhow::{Context, Result};
88
use serde::{Deserialize, Serialize};
9+
use tracing::info;
910

1011
use crate::cli::self_update::SelfUpdateMode;
1112
use crate::dist::{AutoInstallMode, Profile};
1213
use crate::errors::*;
13-
use crate::notifications::*;
1414
use crate::utils;
1515

1616
#[derive(Clone, Debug, Eq, PartialEq)]
@@ -111,14 +111,12 @@ impl Settings {
111111
self.overrides.remove(&key).is_some()
112112
}
113113

114-
pub(crate) fn add_override(
115-
&mut self,
116-
path: &Path,
117-
toolchain: String,
118-
notify_handler: &dyn Fn(Notification<'_>),
119-
) {
114+
pub(crate) fn add_override(&mut self, path: &Path, toolchain: String) {
120115
let key = Self::path_to_key(path);
121-
notify_handler(Notification::SetOverrideToolchain(path, &toolchain));
116+
info!(
117+
"override toolchain for {} set to {toolchain}",
118+
path.display(),
119+
);
122120
self.overrides.insert(key, toolchain);
123121
}
124122

0 commit comments

Comments
 (0)