Common options
The subcommands share some common options that can be used before the subcommand.
Options
--manifest-path
The path to a Cargo.toml
file which is used as the context for operations.
--all-features
(single crate or workspace)
Enables all features when determining which crates to consider. Works for both single crates and workspaces.
--no-default-features
(single crate only)
Disables the default
feature for a crate when determining which crates to consider.
--features
(single crate only)
Space-separated list of features to enable when determining which crates to consider.
--workspace
Forces all workspace crates to be used as roots in the crate graph that we operate on, unless they are excluded by other means. By default, if you specify a virtual manifest, all crates in the workspace will be used as roots. However, if you specify a normal package manifest somewhere inside a workspace, only that crate will be used as a graph root, and only other workspaces crates it depends on will be included in the graph. If you want to specify a sub-crate in a workspace, but still include all other crates in the workspace, you can use this flag.
--exclude-dev
If set to true
, all dev-dependencies
, even one for workspace crates, are not included in the crate graph used for any of the checks.
--exclude
Exclude the specified package(s) from the crate graph. Unlike other cargo subcommands, it doesn't have to be used in conjunction with the --workspace
flag. This flag may be specified multiple times.
This uses a similar (though slightly more strict) Package ID specification to other cargo subcommands.
Packages can also be excluded in your configuration files, specifying this on the command line will append the package ID to the list that may exist in your configuration.
-L, --log-level
The log level for messages, only log messages at or above the level will be emitted.
Possible values:
off
- No output will be emittederror
warn
(default)info
debug
trace
--format
The format of the output of both log and diagnostic messages.
Possible values:
human
(default) - Output for the pesky humansjson
- Each log message/diagnostic is outputted as a single line JSON object
--color
Whether coloring is applied to human-formatted output, using it on JSON output has no effect.
Possible values:
auto
(default) - Coloring is applied if the output stream is a TTYalways
- Coloring is always appliednever
- No coloring is applied for any output
-t, --target
One or more platforms to filter crates with. If a dependency is target specific, it will be ignored if it does not match at least 1 of the specified targets. This overrides the top-level targets = []
configuration value.
--exclude-unpublished
If set, exclude unpublished workspace members from graph roots.
Workspace members are considered unpublished if they they are explicitly marked with publish = false
. Note that the excluded workspace members are still used for the initial dependency resolution by cargo, which might affect the exact version of used dependencies.
--allow-git-index
If set, the crates.io git index is initialized for use in fetching crate information, otherwise it is enabled only if using a cargo < 1.70.0 without the sparse protocol enabled
--locked
Asserts that the exact same dependencies and versions are used as when the existing Cargo.lock file was originally generated. Cargo will exit with an error when either of the following scenarios arises:
- The lock file is missing.
- Cargo attempted to change the lock file due to a different dependency resolution.
--offline
Prevents Cargo and cargo-deny
from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
Beware that this may result in different dependency resolution than online mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline.
cargo-deny
will also not fetch advisory databases with this option, meaning that any new or updated advisories since the last time the database(s) were fetched won't be known and thus won't be checked against the dependency graph.
--frozen
Equivalent to specifying both --locked
and --offline
.