LinuxCommandLibrary

cargo-check

Check a Rust package for errors without compiling

TLDR

Check project for errors

$ cargo check
copy
Check with release profile
$ cargo check --release
copy
Check all workspace members
$ cargo check --workspace
copy
Check specific package
$ cargo check -p [package]
copy
Check all targets
$ cargo check --all-targets
copy
Check including tests
$ cargo check --profile test
copy
Check with specific features
$ cargo check --features [feature1,feature2]
copy

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

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community