bnjbvr/cargo-machete

False positives when indirect dependency is used for enabling features

Closed this issue · 2 comments

For example, I have a repo that depends on parry3d-f64, which does not expose the glam conversion feature. But I am able to enable this feature by adding the nalgebra dependency like this:

nalgebra = { version = "0.32", features = ["convert-glam022"] }
parry3d-f64 = { version = "0.13" }

cargo machete will return a false positive for nalgebra because I am not useing it anywhere, but it is nonetheless still a necessary dependency.

Thanks for opening an issue! Yeah, this is one of these edge cases that cargo-machete can't detect, by design (it can't infer this kind of relationship between dependencies just by looking at the Cargo.toml's content), and for which you could add an ignore rule:

[package.metadata.cargo-machete]
ignored = ["nalgebra"]

Thanks @bnjbvr that should be good enough.