est31 / cargo-udeps

Find unused dependencies in Cargo.toml
Other
1.76k stars 46 forks source link

Do not create `([], [], [])` entries when the dependency is `ignore`d #79

Closed qryxip closed 4 years ago

qryxip commented 4 years ago

Fixes #78.

qryxip commented 4 years ago
[package]
name = "a"
version = "0.1.0"
authors = ["Ryo Yamashita <qryxip@gmail.com>"]
edition = "2018"

[package.metadata.cargo-udeps.ignore]
normal = ["itertools"]

[dependencies]
itertools = "0.9.0"
// actually not using `itertools`
fn main() {
    println!("Hello, world!");
}
❯ cargo +nightly udeps
    Checking a v0.1.0 (/home/ryo/src/local/playground/rs/a)
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
info: Loading save analysis from "/home/ryo/src/local/playground/rs/target/debug/deps/save-analysis/a-5c25196d764acf15.json"
info: Ignoring `itertools` (Normal)
All deps seem to have been used.
❯ cargo +nightly udeps --output json | jq
    Checking a v0.1.0 (/home/ryo/src/local/playground/rs/a)
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
info: Loading save analysis from "/home/ryo/src/local/playground/rs/target/debug/deps/save-analysis/a-5c25196d764acf15.json"
info: Ignoring `itertools` (Normal)
{
  "success": true,
  "unused_deps": {},
  "note": null
}