Add special check-cfg
lint config for the unexpected_cfgs
lint by Urgau · Pull Request #13913 · rust-lang/cargo (original) (raw)
What does this PR try to resolve?
This PR adds a special check-cfg
lint config for the unexpected_cfgs
lint, as it was decided by T-cargo (in today's meeting).
The goal of this lint config is to provide a simple and cost-less alternative to the build-script cargo::rustc-check-cfg
instruction.
[lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(foo, values("bar"))'] }
How should we test and review this PR?
I recommand reviewing commit by commit; and looking at all the new tests added in check_cfg.rs
, I tried making them as exhaustive as I could, many of them are very similar to their non-config counterpart.
Additional information
I didn't add (actually removed from the 1st version of this PR) the possibility to omit the level
field if check-cfg
is specified, #13913 (comment).
Regarding the implementation, I tried making it is as straight forward as possible, nothing over-engineered or complex.
r? @epage (or @weihanglo maybe)