Skip to main content

One post tagged with "rustfmt"

View All Tags

rustup常用命令

rustup是Rust语言的一个安装器。

可以管理Rust Toolchain以及rustup等工具链组件

  1. 查看当前编译器信息
rustup show
  1. 更新Rust Toolchain
rust update
  1. 检查更新Rust Toolchainrustup
rustup check
  1. 设置默认工具链
rustup default -h
  1. 管理component
  • 安装组件
rust component add <component_name>
  • 删除组件
rust component remove <component_name>
  • 列出所有可用组件
rust component list
  • 列出以安装组件
rust component list --installed

Clippy

一系列lints,用于捕获常见错误并改进Rust代码。

安装

rustup update
rustup component add clippy

运行Clippy

cargo clippy

或者

cargo check

自动应用Clippy建议

cargo clippy --fix

配置文件

  • clippy.toml
  • .clippy.toml

Rustfmt

Rust代码格式化工具

安装

rustup component add rustfmt

运行

cargo fmt

配置文件

  • rustfmt.toml
  • .rustfmt.toml

Rust-Analyzer

rust-analyzer是Rust编程语言的语言服务器协议的实现。

鱼雪