cargo-machete icon indicating copy to clipboard operation
cargo-machete copied to clipboard

False positives for multi-dep single `use` statements

Open Billy-Sheppard opened this issue 1 year ago • 1 comments

Not sure if this is a known drawback of this crate, but my project has a rustfmt.toml that collapses all imports into one use/pub use {} block. This seems to cause all the crates to be returned as false positives.

pub use {async_trait, futures, reqwest};
cargo-machete found the following unused dependencies in /var/home/...
my_crate -- /var/home/ ... /Cargo.toml:
        async_trait
        futures
        reqwest

Billy-Sheppard avatar Oct 15 '23 22:10 Billy-Sheppard

Thanks for opening an issue; that looks like a real bug (in general, cargo-machete should give too many unused dependencies, not too few). Probably the regular expressions would need to be tweaked, if you feel like investigating that using the helper project, that could be fun and fixing that would be useful!

bnjbvr avatar Oct 25 '23 17:10 bnjbvr