Rust Cargo update crate.io index 时无响应

Rust About 468 words

现象

IDEA中添加RustCargo应用时,一直卡在update xxx index阶段,非常耗时。

尝试解决

试过使用mirror,但仍然无效。

解决方法

对于没有外部依赖的项目,可以配置net.offlinetrue,也可以在cargo run时指定--offline

新建~/.cargo/config配置。

完整配置:(无需添加镜像,只需指定[net] offline即可)

[net]
offline = true

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'

[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

更多配置

https://doc.rust-lang.org/cargo/reference/config.html#configuration-format

Views: 1,250 · Posted: 2023-04-29

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh