Skip to content

Commit

Permalink
fix: rust idiomatic file parsing (#3241)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx authored Nov 27, 2024
1 parent a8cdb2d commit 9c13dcc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
3 changes: 1 addition & 2 deletions docs/registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ You can also specify the full name for a tool using `mise use aqua:1password/cli
| elasticsearch | [asdf:asdf-community/asdf-elasticsearch](https://github.com/asdf-community/asdf-elasticsearch) |
| elixir | [asdf:mise-plugins/mise-elixir](https://github.com/mise-plugins/mise-elixir) [vfox:version-fox/vfox-elixir](https://github.com/version-fox/vfox-elixir) |
| elixir-ls | [asdf:juantascon/asdf-elixir-ls](https://github.com/juantascon/asdf-elixir-ls) |
| elm | [asdf:asdf-community/asdf-elm](https://github.com/asdf-community/asdf-elm) |
| embulk | [asdf:yuokada/asdf-embulk](https://github.com/yuokada/asdf-embulk) |
| elm | [ubi:elm/compiler](https://github.com/elm/compiler) [asdf:asdf-community/asdf-elm](https://github.com/asdf-community/asdf-elm) |
| emsdk | [asdf:RobLoach/asdf-emsdk](https://github.com/RobLoach/asdf-emsdk) |
| envcli | [asdf:zekker6/asdf-envcli](https://github.com/zekker6/asdf-envcli) |
| envsubst | [aqua:a8m/envsubst](https://github.com/a8m/envsubst) [asdf:dex4er/asdf-envsubst](https://github.com/dex4er/asdf-envsubst) |
Expand Down
9 changes: 8 additions & 1 deletion e2e/plugins/core/test_rust
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@
export MISE_RUSTUP_HOME="$MISE_DATA_DIR/rustup"
export MISE_CARGO_HOME="$MISE_DATA_DIR/cargo"

assert_contains "mise x rust@1.82.0 -- rustc --version" "rustc 1.82.0"
assert_contains "mise x rust@1.81.0 -- rustc --version" "rustc 1.81.0"

cat <<EOF >rust-toolchain.toml
[toolchain]
channel = "1.81.0"
EOF

assert_contains "mise x -- rustc --version" "rustc 1.81.0"
4 changes: 2 additions & 2 deletions registry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ elasticsearch.backends = ["asdf:asdf-community/asdf-elasticsearch"]
elixir.backends = ["asdf:mise-plugins/mise-elixir", "vfox:version-fox/vfox-elixir"]
elixir.depends = ["erlang"]
elixir-ls.backends = ["asdf:juantascon/asdf-elixir-ls"]
elm.backends = ["asdf:asdf-community/asdf-elm"]
embulk.backends = ["asdf:yuokada/asdf-embulk"]
elm.backends = ["ubi:elm/compiler[exe=elm]", "asdf:asdf-community/asdf-elm"]
elm.test = ["elm --version", "{{version}}"]
emsdk.backends = ["asdf:RobLoach/asdf-emsdk"]
envcli.backends = ["asdf:zekker6/asdf-envcli"]
envsubst.backends = ["aqua:a8m/envsubst", "asdf:dex4er/asdf-envsubst"]
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/core/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl Backend for RustPlugin {
let toml = toml.parse::<toml::Value>()?;
if let Some(toolchain) = toml.get("toolchain") {
if let Some(channel) = toolchain.get("channel") {
return Ok(channel.to_string());
return Ok(channel.as_str().unwrap().to_string());
}
}
Ok("".into())
Expand All @@ -100,7 +100,7 @@ impl Backend for RustPlugin {
.execute()?;

file::remove_all(tv.install_path())?;
file::make_symlink(&cargo_home().join(&tv.version), &tv.install_path())?;
file::make_symlink(&cargo_home().join("bin"), &tv.install_path())?;

self.test_rust(ctx, &tv)?;

Expand Down

0 comments on commit 9c13dcc

Please sign in to comment.