02-构建命令

build、check、test、run 等构建相关命令

译文 · 基于 The Cargo Book

构建命令

原文链接: https://doc.rust-lang.org/cargo/commands/build-commands.html


01-cargo bench

cargo-bench(1) 运行基准测试

02-cargo build

cargo-build(1) 编译当前包

03-cargo check

cargo-check(1) 检查包能否编译

04-cargo clean

cargo-clean(1) 清理目标文件

05-cargo clippy

cargo-clippy(1) 运行 Clippy

06-cargo doc

cargo-doc(1) 构建文档

07-cargo fetch

cargo-fetch(1) 下载依赖

08-cargo fix

cargo-fix(1) 自动修复警告

09-cargo fmt

cargo-fmt(1) 格式化代码

10-cargo miri

cargo-miri(1) 用 Miri 解释执行

11-cargo run

cargo-run(1) 运行二进制目标

12-cargo rustc

cargo-rustc(1) 向 rustc 传额外参数

13-cargo rustdoc

cargo-rustdoc(1) 向 rustdoc 传额外参数

14-cargo test

cargo-test(1) 运行测试

最后修改 August 11, 2026: 更新 (70a5af133)