Skip to content

Commit

Permalink
fix: elan show without default toolchain
Browse files Browse the repository at this point in the history
Fixes #33
  • Loading branch information
Kha committed May 24, 2021
1 parent e1c024d commit d73b672
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Unreleased

## Changed

- Update suggestion when no default toolchain is configured (#31)
- Fix `elan show` when no default toolchain is configured (#33)

# 1.0.3 - 2021-04-30

## Changed
Expand Down
2 changes: 1 addition & 1 deletion src/elan-cli/elan_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ fn show(cfg: &Cfg) -> Result<()> {
if show_headers { print_header("installed toolchains") }
let default_name = try!(cfg.get_default());
for t in installed_toolchains {
if default_name == t {
if default_name.as_ref() == Some(&t) {
println!("{} (default)", t);
} else {
println!("{}", t);
Expand Down
4 changes: 2 additions & 2 deletions src/elan/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ impl Cfg {
})
}

pub fn get_default(&self) -> Result<String> {
pub fn get_default(&self) -> Result<Option<String>> {
self.settings_file.with(|s| {
Ok(s.default_toolchain.clone().unwrap())
Ok(s.default_toolchain.clone())
})
}

Expand Down

0 comments on commit d73b672

Please sign in to comment.