rust startup
安装
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# update path
source $HOME/.cargo/env
# update rust
rustup update
# 安装 clippy
rustup component add clippy
# run clippy
cargo clippy --fix
vscode 开发配置
.vscode/settings.json 配置
{
"editor.tabSize": 4,
"editor.inlayHints.enabled": "off",
"editor.formatOnSave": true,
"rust-analyzer.files.excludeDirs": [".vscode/", "target/"],
"[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[rust]": { "editor.defaultFormatter": "rust-lang.rust-analyzer" },
"rust-analyzer.checkOnSave.command": "clippy",
"debug.allowBreakpointsEverywhere": true,
"editor.codeActionsOnSave": { "source.fixAll": true, "source.organizeImports": true }
}
rust-analyzer 插件
Refer