cargo-check
Check a Rust package for errors without compiling
TLDR
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]
SYNOPSIS
cargo check [options]
DESCRIPTION
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.
PARAMETERS
-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
CAVEATS
Some errors only appear during full code generation and won't be caught by cargo check. For complete error checking, use cargo build. The --profile test enables test cfg and checks test code.
SEE ALSO
cargo(1), cargo-build(1), cargo-fix(1)
