est31 / cargo-udeps

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

False positives from derive macro #143

Open pacak opened 2 years ago

pacak commented 2 years ago

I'm running cargo udeps as this:

% cargo udeps --workspace --all-targets --backend save-analysis --show-unused-transitive

and getting a whole bunch of false positives, most of which are coming from either derive macro or macro in general.

It would be great to be able to pass something --no-proc-macro to automagically exclude derive macros from the output. It should be able to tell if something is a derive macro somewhere around cargo output.

est31 commented 2 years ago

Why have you enabled the save-analysis backend? Does the non-save-analysis backend have false positives?

pacak commented 2 years ago

Why have you enabled the save-analysis backend?

To get --show-unused-transitive working - according to --help it depends on save-analysis.

Does the non-save-analysis backend have false positives?

No, but it ignores a bunch of redundant transitive dependencies.

I'm on 0.1.35

est31 commented 2 years ago

Yeah, save-analysis has bad macro support... also note that save-analysis is being removed from rustc, so using the save-analysis backend at all won't be possible for long: https://github.com/rust-lang/rust/pull/101841

pacak commented 2 years ago

Is there a plan to implement transitive dependencies report without it?

est31 commented 2 years ago

I don't know of a trick how to do it, outside of using the unstable rustc feature to dump unused dependencies to json. Maybe we can add a backend for that :).