0
点赞
收藏
分享

微信扫一扫

详解Rust多线程编程

凶猛的小白兔 2024-12-02 阅读 15

现象:
使用vscode 格式化.rs 文档的时候,一直没有反应。
cargo run命令没问题
cargo fmt会报错This version of rustfmt is deprecated. Use rustfmt-nightly. Use --force to run deprecated rustfmt.
询问GPT,一直让rustup component add rustfmt来安装,却提示已经安装,而cargo fmt仍然报错。

原因:
请添加图片描述
cargo 的所有命令是在这个文件夹下的。
我使用的 brew 安装,所以这里都应该是软链接,连接到/opt/homebrew/Cellar/rustup文件夹下。

~/.cargo/bin % ls -n /opt/homebrew/Cellar/rustup/1.27.1_1/bin/cargo-fmt
lrwxr-xr-x 1 501 80 11 Apr 24 2024 /opt/homebrew/Cellar/rustup/1.27.1_1/bin/cargo-fmt -> rustup-init

但是这里却有一些二进制文件,应该之前使用别的方式安装的时候,没清理干净,导致这里生成软链接失败。
所以找到 brew安装目录下的二进制文件,软链接过来就好了。

举报

相关推荐

0 条评论