Crates.io | cargo-udeps |
lib.rs | cargo-udeps |
version | |
source | src |
created_at | 2019-08-30 16:09:06.25547 |
updated_at | 2024-11-30 14:27:35.40472 |
description | Find unused dependencies in Cargo.toml |
homepage | |
repository | https://github.com/est31/cargo-udeps |
max_upload_size | |
id | 160938 |
Cargo.toml error: | TOML parse error at line 21, column 1 | 21 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Find unused dependencies in Cargo.toml.
While compilation of this tool also works on Rust stable, it needs Rust nightly to actually run.
https://github.com/est31/cargo-udeps/releases
cargo install
(crates.io)cargo install cargo-udeps --locked
cargo install
(master
)cargo install --git https://github.com/est31/cargo-udeps --locked
Some package managers have packaged cargo-udeps
:
cargo-udeps
pacman -S cargo-udeps
brew install cargo-udeps
cargo +nightly udeps
It either prints out a "unused crates" line listing the crates, or it prints out a line saying that no crates were unused.
You can use it as pre-commit hook:
- repo: https://github.com/est31/cargo-udeps
rev: v0.1.47
hooks:
- id: udeps
To ignore some of the dependencies, add package.metadata.cargo-udeps.ignore
to Cargo.toml
.
[package.metadata.cargo-udeps.ignore]
normal = ["if_chain"]
#development = []
#build = []
[dependencies]
if_chain = "1.0.0" # Used only in doc-tests, which `cargo-udeps` cannot check.
Alternatively, add dependencies to workspace.metadata.cargo-udeps.ignore
in the
workpace Cargo.toml
to ignore them in all packages in the workspace.
Some unused crates might not be detected. This includes crates used by std and its dependencies as well as crates that are already being used by dependencies of the studied crate.
Crates are currently only handled on a per name basis. Two crates with the same name but different versions would be a problem.
This is a list of cases where unused dependencies were found using cargo-udeps. You are welcome to expand it:
See CONTRIBUTING.md for details.
This tool is distributed under the terms of both the MIT license and the Apache License (Version 2.0), at your option.
See LICENSE for details.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.