You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Detect and warn on uses of cfg(feature = "foo") where the feature ("foo") isn't declared in the Cargo.toml file.
Advantage
The cfg always evaluates to false, which is likely not intended (e.g. typo, feature that was renamed in the Cargo.toml file but not everywhere in the code, etc.).
Drawbacks
I don't see any reason to have a cfg based on a feature that doesn't exist.
Example
# Cargo.toml
[features]
bar = []
let x = 0;// Feature "foo" isn't defined in the Cargo.toml file.#[cfg(feature = "foo")]
x = 42;
The text was updated successfully, but these errors were encountered:
Closing as a duplicate of #11649. This already exists unstably in cargo as -Zcheck-cfg, and is close to being stabilized it looks like (tracking issue: rust-lang/rust#82450)
warning: unexpected `cfg` condition value: `foo`
--> src/main.rs:4:11
|
4 | #[cfg(feature = "foo")]
| ^^^^^^^^^^^^^^^ help: remove the condition
|
= note: no expected values for `feature`
= help: consider adding `foo` as a feature in `Cargo.toml`
What it does
Detect and warn on uses of
cfg(feature = "foo")
where the feature ("foo") isn't declared in the Cargo.toml file.Advantage
The cfg always evaluates to false, which is likely not intended (e.g. typo, feature that was renamed in the Cargo.toml file but not everywhere in the code, etc.).
Drawbacks
I don't see any reason to have a
cfg
based on a feature that doesn't exist.Example
The text was updated successfully, but these errors were encountered: