Skip to content

Commit d4dc63b

Browse files
committed
refactor(config): accept Cfg in EnsureInstalled::warn_auto_install()
1 parent dce67db commit d4dc63b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ impl<T> EnsureInstalled<T> {
142142
}
143143

144144
impl<T: Display> EnsureInstalled<T> {
145-
fn warn_auto_install(&self, process: &Process) {
145+
fn warn_auto_install(&self, cfg: &Cfg<'_>) {
146146
// If we're already in a recursion, or we haven't just installed the active toolchain, then
147147
// don't print the warning.
148-
let recursions = process.var("RUST_RECURSION_COUNT");
148+
let recursions = cfg.process.var("RUST_RECURSION_COUNT");
149149
if recursions.is_ok_and(|it| it != "0") || !matches!(self.status, UpdateStatus::Installed) {
150150
return;
151151
}
@@ -562,7 +562,7 @@ impl<'a> Cfg<'a> {
562562
match self.ensure_active_toolchain(true, false).await {
563563
Ok(r) => {
564564
let (tc, source) = r;
565-
tc.warn_auto_install(self.process);
565+
tc.warn_auto_install(self);
566566
Ok(Some((tc.inner, source)))
567567
}
568568
Err(e) => match e.downcast_ref::<RustupError>() {
@@ -768,7 +768,7 @@ impl<'a> Cfg<'a> {
768768
let install_if_missing = self.should_auto_install()?;
769769
let EnsureInstalled { inner: tc, status } =
770770
Toolchain::from_local(tc, install_if_missing, self).await?;
771-
EnsureInstalled::new(tc.name(), status).warn_auto_install(self.process);
771+
EnsureInstalled::new(tc.name(), status).warn_auto_install(self);
772772
Ok((tc, source))
773773
}
774774
None => {

0 commit comments

Comments
 (0)