Skip to content

Commit 5308826

Browse files
committed
feat(config): warn user if auto-install is enabled
1 parent d4074c7 commit 5308826

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/config.rs

Lines changed: 10 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::trace;
11+
use tracing::{info, trace, warn};
1212

1313
use crate::dist::AutoInstallMode;
1414
use crate::{
@@ -386,12 +386,20 @@ impl<'a> Cfg<'a> {
386386
}
387387

388388
pub(crate) fn should_auto_install(&self) -> Result<bool> {
389-
if let Ok(mode) = self.process.var("RUSTUP_AUTO_INSTALL") {
389+
let res = if let Ok(mode) = self.process.var("RUSTUP_AUTO_INSTALL") {
390390
Ok(mode != "0")
391391
} else {
392392
self.settings_file
393393
.with(|s| Ok(s.auto_install != Some(AutoInstallMode::Disable)))
394+
}?;
395+
if res {
396+
warn!("auto-install is enabled, active toolchain will be installed if absent");
397+
warn!("this behavior is deprecated and will be removed in a future version");
398+
info!(
399+
"you may opt out now with `RUSTUP_AUTO_INSTALL=0` or `rustup set auto-install disable`"
400+
);
394401
}
402+
Ok(res)
395403
}
396404

397405
// Returns a profile, if one exists in the settings file.

0 commit comments

Comments
 (0)