gpt4 book ai didi

rust - 如何在 Rust 工具链之间切换?

转载 作者:行者123 更新时间:2023-11-29 08:26:04 29 4
gpt4 key购买 nike

rustup help toolchain 列出了以下子命令

SUBCOMMANDS:
list List installed toolchains
install Install or update a given toolchain
uninstall Uninstall a toolchain
link Create a custom toolchain by symlinking to a directory
help Prints this message or the help of the given subcommand(s)

我安装了以下工具链

stable-x86_64-unknown-linux-gnu (default)
nightly-2019-09-05-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu
master

我试图解决 rust-clippy 的问题,所以我必须安装主工具链。尽管 stable 被设置为我的默认工具链,但我当前的工具链是 master,我想切换回 stable。如何在不卸载主工具链的情况下执行此操作?

没有switch子命令吗?

最佳答案

当然 rustup default stable 命令运行良好,但最简单的方法是在项目根文件夹中保留一个 rust-toolchain 文件。类似于您为 Node.js 项目保留 .nvm 文件的方式。

请注意,如果您使用 rust-toolchain.toml 而不仅仅是 rust-toolchain,您将需要添加类似于 JSON ref 的所需部分因此我更喜欢简单的 rust-toolchain 文件,它不需要任何类似于 Node.js 的 .nvm 文件的部分。

rust 工具链

nightly

screenshot of IDE with rust-toolchain file

stable

关于rust - 如何在 Rust 工具链之间切换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58226545/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com