myproject v0.1.0 (/myproject) `-- rand v0.7.3 |-- getrandom v0.1.14 | |-- cfg-if v0.1.10 | `-- libc v0.2.68 |-- libc v0.2.68 (*) |-- rand_chacha v0.2.2 | |-- ppv-lite86 v0.2.6 | `-- rand_core v0.5.1 | `-- getrandom v0.1.14 (*) `-- rand_core v0.5.1 (*) [build-dependencies] `-- cc v1.0.50
myproject v0.1.0 (/myproject) `-- log feature "serde" `-- log v0.4.8 |-- serde v1.0.106 `-- cfg-if feature "default" `-- cfg-if v0.1.10
Show the reverse dependencies for the given package. This flag will invert the tree and display the packages that depend on the given package. Note that in a workspace, by default it will only display the package\[cq]s reverse dependencies inside the tree of the workspace member in the current directory. The --workspace flag can be used to extend it so that it will show the package\[cq]s reverse dependencies across the entire workspace. The -p flag can be used to display the package\[cq]s reverse dependencies only with the subtree of the package given to -p.
Prune the given package from the display of the dependency tree.
Maximum display depth of the dependency tree. A depth of 1 displays the direct dependencies, for example.
Do not de-duplicate repeated dependencies. Usually, when a package has already displayed its dependencies, further occurrences will not re-display its dependencies, and will include a (*) to indicate it has already been shown. This flag will cause those duplicates to be repeated.
Show only dependencies which come in multiple versions (implies --invert). When used with the -p flag, only shows duplicates within the subtree of the given package. It can be beneficial for build times and executable sizes to avoid building that same package multiple times. This flag can help identify the offending packages. You can then investigate if the package that depends on the duplicate with the older version can be updated to the newer version so that only one instance is built.
The dependency kinds to display. Takes a comma separated list of values:
\h'-04'\(bu\h'+02'all \[em] Show all edge kinds.
\h'-04'\(bu\h'+02'normal \[em] Show normal dependencies.
\h'-04'\(bu\h'+02'build \[em] Show build dependencies.
\h'-04'\(bu\h'+02'dev \[em] Show development dependencies.
\h'-04'\(bu\h'+02'features \[em] Show features enabled by each dependency. If this is the only kind given, then it will automatically include the other dependency kinds.
\h'-04'\(bu\h'+02'no-normal \[em] Do not include normal dependencies.
\h'-04'\(bu\h'+02'no-build \[em] Do not include build dependencies.
\h'-04'\(bu\h'+02'no-dev \[em] Do not include development dependencies.
\h'-04'\(bu\h'+02'no-proc-macro \[em] Do not include procedural macro dependencies.
Filter dependencies matching the given target triple <https://doc.rust-lang.org/cargo/appendix/glossary.html#target>. The default is the host platform. Use the value all to include all targets.
Chooses the character set to use for the tree. Valid values are \[lq]utf8\[rq] or \[lq]ascii\[rq]. When unspecified, cargo will auto-select a value.
Set the format string for each package. The default is \[lq]{p}\[rq]. This is an arbitrary string which will be used to display each package. The following strings will be replaced with the corresponding value:
\h'-04'\(bu\h'+02'{p} \[em] The package name.
\h'-04'\(bu\h'+02'{l} \[em] The package license.
\h'-04'\(bu\h'+02'{r} \[em] The package repository URL.
\h'-04'\(bu\h'+02'{f} \[em] Comma-separated list of package features that are enabled.
\h'-04'\(bu\h'+02'{lib} \[em] The name, as used in a use statement, of the package\[cq]s library.
Sets how each line is displayed. The prefix value can be one of:
\h'-04'\(bu\h'+02'indent (default) \[em] Shows each line indented as a tree.
\h'-04'\(bu\h'+02'depth \[em] Show as a list, with the numeric depth printed before each entry.
\h'-04'\(bu\h'+02'none \[em] Show as a flat list.
Display only the specified packages. See cargo-pkgid(1) for the SPEC format. This flag may be specified multiple times and supports common Unix glob patterns like *, ? and []. However, to avoid your shell accidentally expanding glob patterns before Cargo handles them, you must use single quotes or double quotes around each pattern.
Display all members in the workspace.
Exclude the specified packages. Must be used in conjunction with the --workspace flag. This flag may be specified multiple times and supports common Unix glob patterns like *, ? and []. However, to avoid your shell accidentally expanding glob patterns before Cargo handles them, you must use single quotes or double quotes around each pattern.
Path to the Cargo.toml file. By default, Cargo searches for the Cargo.toml file in the current directory or any parent directory.
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:
\h'-04'\(bu\h'+02'The lock file is missing.
\h'-04'\(bu\h'+02'Cargo attempted to change the lock file due to a different dependency resolution.
Prevents Cargo 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. May also be specified with the net.offline config value <https://doc.rust-lang.org/cargo/reference/config.html>.
Equivalent to specifying both --locked and --offline.
Space or comma separated list of features to activate. Features of workspace members may be enabled with package-name/feature-name syntax. This flag may be specified multiple times, which enables all specified features.
Activate all available features of all selected packages.
Do not activate the default feature of the selected packages.
Use verbose output. May be specified twice for \[lq]very verbose\[rq] output which includes extra output such as dependency warnings and build script output. May also be specified with the term.verbose config value <https://doc.rust-lang.org/cargo/reference/config.html>.
Do not print cargo log messages. May also be specified with the term.quiet config value <https://doc.rust-lang.org/cargo/reference/config.html>.
Control when colored output is used. Valid values:
\h'-04'\(bu\h'+02'auto (default): Automatically detect if color support is available on the terminal.
\h'-04'\(bu\h'+02'always: Always display colors.
\h'-04'\(bu\h'+02'never: Never display colors.
If Cargo has been installed with rustup, and the first argument to cargo begins with +, it will be interpreted as a rustup toolchain name (such as +stable or +nightly). See the rustup documentation <https://rust-lang.github.io/rustup/overrides.html> for more information about how toolchain overrides work.
Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE, or provided as a path to an extra configuration file. This flag may be specified multiple times. See the command-line overrides section <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides> for more information.
Changes the current working directory before executing any specified operations. This affects things like where cargo looks by default for the project manifest (Cargo.toml), as well as the directories searched for discovering .cargo/config.toml, for example. This option must appear before the command name, for example cargo -C path/to/my-project build. This option is only available on the nightly channel <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and requires the -Z unstable-options flag to enable (see #10098 <https://github.com/rust-lang/cargo/issues/10098>).
Prints help information.
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
\h'-04'\(bu\h'+02'0: Cargo succeeded.
\h'-04'\(bu\h'+02'101: Cargo failed to complete.
\h'-04' 1.\h'+01'Display the tree for the package in the current directory:
cargo tree
\h'-04' 2.\h'+01'Display all the packages that depend on the syn package:
cargo tree -i syn
\h'-04' 3.\h'+01'Show the features enabled on each package:
cargo tree --format "{p} {f}"
\h'-04' 4.\h'+01'Show all packages that are built multiple times. This can happen if multiple semver-incompatible versions appear in the tree (like 1.0.0 and 2.0.0).
cargo tree -d
\h'-04' 5.\h'+01'Explain why features are enabled for the syn package:
cargo tree -e features -i syn
syn v1.0.17 |-- syn feature "clone-impls" | `-- syn feature "default" | `-- rustversion v1.0.2 | `-- rustversion feature "default" | `-- myproject v0.1.0 (/myproject) | `-- myproject feature "default" (command-line) |-- syn feature "default" (*) |-- syn feature "derive" | `-- syn feature "default" (*) |-- syn feature "full" | `-- rustversion v1.0.2 (*) |-- syn feature "parsing" | `-- syn feature "default" (*) |-- syn feature "printing" | `-- syn feature "default" (*) |-- syn feature "proc-macro" | `-- syn feature "default" (*) `-- syn feature "quote" |-- syn feature "printing" (*) `-- syn feature "proc-macro" (*)