@argv_minus_one@mastodon.sdf.org
2026-05-08 23:56 UTC
@epage@hachyderm.io
I wonder if it's possible to also detect unused features.
Some features don't add any items, only change existing items' behavior, so this may be impossible. Sure would be neat, though.
Replies (1)
-
@epage@hachyderm.io 2026-05-09 00:09
@argv_minus_one@mastodon.sdf.org One approach would be a cross crate used/unused pub item tracking with what cfgs the item has. Cargo could then report if all pub items for a feature are unused. This would only have false positives for features that are both behavior changes and API additions. This would also be useful for workspace-private crates for detecting unused code. I'm assuming this would be expensive to track, including the serializing and deserializing of intermediate state between rustc and cargo.