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 undefined features #8301

Closed
EFanZh opened this issue Jan 17, 2022 · 3 comments
Closed

Check usages of undefined features #8301

EFanZh opened this issue Jan 17, 2022 · 3 comments
Labels
A-lint Area: New lints

Comments

@EFanZh
Copy link

EFanZh commented Jan 17, 2022

What it does

Warn usages of features that are not defined in features section of Cargo.toml and are not optional dependencies.

Lint Name

undefined-features

Category

correctness, suspicious

Advantage

  • Check misspelled feature names.
  • Check unused code.

Drawbacks

No response

Example

fn foo() {}

#[cfg(feature = "bar")]
fn bar() {}

If feature "bar" is not defined in Cargo.toml, the code above could be written as:

fn foo() {}
@EFanZh EFanZh added the A-lint Area: New lints label Jan 17, 2022
@jplatte
Copy link
Contributor

jplatte commented Feb 8, 2022

Duplicate of #1614.

@epage
Copy link

epage commented Mar 4, 2024

Looks like there is also #11649 for this. There is also native support coming to rustc/cargo, see rust-lang/rust#82450

@Alexendoo
Copy link
Member

Closing in favour of rust-lang/rust#82450

@Alexendoo Alexendoo closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2024
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

4 participants