bnjbvr / cargo-machete

Remove unused Rust dependencies with this one weird trick!
MIT License
784 stars 28 forks source link

`--with-metadata` does not correctly analyze build scripts #127

Open mqudsi opened 5 months ago

mqudsi commented 5 months ago

I understand this is somewhat of a known issue, but I was a bit surprised that cargo-machete prompted to use --with-metadata for "more accuracy" but when I did that it ended up incorrectly flagging build dependencies (that don't also appear as normal dependencies in Cargo.toml) as unused.

I'm not sure what's considered verboten or in- vs out-of-scope for machete, but there are quite a few approaches that could be used specifically for the case of build dependencies, and you normally have their exact path (either build.rs or the build field from Cargo.toml).

Just some food for thought. Thanks for making this tool :)

juntyr commented 4 months ago

+1