Skip to content

Commit d05498e

Browse files
scimasrami3l
authored andcommitted
Fix misleading "uninstalled toolchain" notification
Added a check to see if any filesystem modification was done.
1 parent 75005f8 commit d05498e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/toolchain/toolchain.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ impl<'a> Toolchain<'a> {
447447
LocalToolchainName::Named(t) => t,
448448
LocalToolchainName::Path(_) => bail!("Cannot remove a path based toolchain"),
449449
};
450-
match Self::exists(cfg, &(&name).into())? {
450+
let fs_modified = match Self::exists(cfg, &(&name).into())? {
451451
true => {
452452
(cfg.notify_handler)(Notification::UninstallingToolchain(&name));
453453
let installed_paths = match &name {
@@ -466,19 +466,22 @@ impl<'a> Toolchain<'a> {
466466
}
467467
}
468468
}
469+
true
469470
}
470471
false => {
471472
// Might be a dangling symlink
472473
if path.is_symlink() {
473474
(cfg.notify_handler)(Notification::UninstallingToolchain(&name));
474475
fs::remove_dir_all(&path)?;
476+
true
475477
} else {
476478
info!("no toolchain installed for '{name}'");
479+
false
477480
}
478481
}
479-
}
482+
};
480483

481-
if !path.is_symlink() && !path.exists() {
484+
if !path.is_symlink() && !path.exists() && fs_modified {
482485
(cfg.notify_handler)(Notification::UninstalledToolchain(&name));
483486
}
484487
Ok(())

0 commit comments

Comments
 (0)