Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
address comments
  • Loading branch information
Rustin170506 committed May 12, 2021
1 parent 9413cb6 commit ec192fe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
14 changes: 7 additions & 7 deletions doc/src/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ This is the essence of `rustup`.

## Keeping rustup up to date

We control the automatic update of rustup by setting the auto-self-update configuration.
The auto-self-update setting supports three values: `enable` and `disable` and `check-only`.
It is possible to control Rustup's automatic self update mechanism with the `auto-self-update` configuration
variable. This setting supports three values: `enable` and `disable` and `check-only`.

When it is `enable`, running `rustup update` will also check for updates to `rustup` and automatically install the latest version.
If it is `disable`, the available updates is not checked and installed.
In addition, you can set auto-self-update to `check-only` if you want to check rustup for available updates during `rustup update` as well.
* `disable` will ensure that no automatic self updating actions are taken.
* `enable` will mean that `rustup update` and similar commands will also check-for, and install, any update to Rustup.
* `check-only` will cause any automatic self update to check and report on any updates, but not to automatically install them.

To manually force check for updates and install the
latest version of `rustup` without updating installed toolchains type `rustup
Whether automatic self-update is enabled or not, you can request that Rustup check for, and update it self to the
latest version of `rustup` without updating any installed toolchains by running `rustup
self update`:

```console
Expand Down
3 changes: 2 additions & 1 deletion src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ fn check_updates(cfg: &Cfg) -> Result<utils::ExitCode> {

fn update(cfg: &mut Cfg, m: &ArgMatches<'_>) -> Result<utils::ExitCode> {
let self_update_mode = cfg.get_self_update_mode()?;
// Priority: no-self-update feature > self_update_mode > no-self-update args.
// Update only if rustup does **not** have the no-self-update feature,
// and auto-self-update is configured to **enable**
// and has **no** no-self-update parameter.
Expand Down Expand Up @@ -1023,7 +1024,7 @@ fn update(cfg: &mut Cfg, m: &ArgMatches<'_>) -> Result<utils::ExitCode> {
cfg.temp_cfg.clean();
}

if !self_update && self_update_mode == "check-only" {
if !self_update::NEVER_SELF_UPDATE && self_update_mode == "check-only" {
check_rustup_update()?;
}

Expand Down
1 change: 1 addition & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ impl Cfg {
Ok(())
}

// FIXME(hi-rustin): It is better to use enumerations rather than strings.
pub fn set_auto_self_update(&mut self, mode: &str) -> Result<()> {
if !SELF_UPDATE_MODES.contains(&mode) {
return Err(anyhow!(
Expand Down
2 changes: 1 addition & 1 deletion src/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<'a> Display for Notification<'a> {
name
),
SetProfile(name) => write!(f, "profile set to '{}'", name),
SetSelfUpdate(mode) => write!(f, "self update mode to '{}'", mode),
SetSelfUpdate(mode) => write!(f, "auto-self-update mode set to '{}'", mode),
LookingForToolchain(name) => write!(f, "looking for installed toolchain '{}'", name),
ToolchainDirectory(path, _) => write!(f, "toolchain directory: '{}'", path.display()),
UpdatingToolchain(name) => write!(f, "updating existing install for '{}'", name),
Expand Down

0 comments on commit ec192fe

Please sign in to comment.