Linux command
cargo-check 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Check project for errors
cargo check
Check with release profile
cargo check --release
Check all workspace members
cargo check --workspace
Check specific package
cargo check -p [package]
Check all targets
cargo check --all-targets
Check including tests
cargo check --profile test
Check with specific features
cargo check --features [feature1,feature2]
说明
cargo check checks a package and dependencies for errors without performing code generation. Faster than cargo build because it skips the final compilation step. Saves metadata for incremental compilation.
参数
- -r, --release
- Check with release profile optimizations
- --profile _name_
- Check with specific profile
- -p, --package _spec_
- Check only specified packages
- --workspace
- Check all workspace members
- --all-targets
- Check all targets (lib, bins, tests, benches, examples)
- --lib
- Check library only
- --bins
- Check all binaries
- --tests
- Check test targets
- --target _triple_
- Check for target platform
- -j, --jobs _n_
- Parallel jobs
- --features _features_
- Enable specified features
- --all-features
- Enable all features
- --no-default-features
- Disable default features
- --message-format _FMT_
- Error format: human, json, short
- --future-incompat-report
- Output future incompatibility report
FAQ
What is the cargo-check command used for?
cargo check checks a package and dependencies for errors without performing code generation. Faster than cargo build because it skips the final compilation step. Saves metadata for incremental compilation.
How do I run a basic cargo-check example?
Run `cargo check` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -r, --release do in cargo-check?
Check with release profile optimizations