Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check usages of empty features #8402

Open
ShadowJonathan opened this issue Feb 8, 2022 · 1 comment
Open

Check usages of empty features #8402

ShadowJonathan opened this issue Feb 8, 2022 · 1 comment
Labels
A-lint Area: New lints

Comments

@ShadowJonathan
Copy link

What it does

Check for all "empty" features in Cargo.toml (a_feature = []), with no optional dependency name collisions, and try to find if any config attribute in the file has that feature, if it doesn't, raise.

Lint Name

unused_crate_feature

Category

pedantic

Advantage

  • Allow libraries to clean up unused features, which could then signal downstream that something has changed.
  • Cleaner code and crates, with less "cruft"

Drawbacks

Possible false-positives if cargo were to infer more from features in the future (other than optional dependencies and the likes)

Example

[features]
a_thing = []

This feature is nowhere to be found in any source code, so this raises the warning.

@ShadowJonathan ShadowJonathan added the A-lint Area: New lints label Feb 8, 2022
@ShadowJonathan
Copy link
Author

#8301 and #1614 are related to this lint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

No branches or pull requests

1 participant