Skip to content

Commit e65e0ad

Browse files
Urgauepage
andauthored
Apply suggestions from epage
Co-authored-by: Ed Page <[email protected]>
1 parent 1337ead commit e65e0ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

posts/2024-05-06-check-cfg.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This is another step to our commitment to provide user-focused tooling and we ar
1717

1818
## A look at the feature
1919

20-
Every time a Cargo feature is declared that feature is transformed into a config that is passed to `rustc` (the Rust compiler) so it can verify with its [well known cfgs](https://doc.rust-lang.org/nightly/rustc/check-cfg.html#well-known-names-and-values) if any of the `#[cfg]`, `#![cfg_attr]` and `cfg!` have unexpected configs and report a warning with the `unexpected_cfgs` lint.
20+
Every time a Cargo feature is declared that feature is transformed into a config that is passed to `rustc` (the Rust compiler) so it can verify with it along with [well known cfgs](https://doc.rust-lang.org/nightly/rustc/check-cfg.html#well-known-names-and-values) if any of the `#[cfg]`, `#![cfg_attr]` and `cfg!` have unexpected configs and report a warning with the `unexpected_cfgs` lint.
2121

2222
*`Cargo.toml`*:
2323

@@ -81,7 +81,7 @@ fn main() {
8181
}
8282
```
8383

84-
> Each `cargo::rustc-cfg` must always have a accompanying **unconditional** `cargo::rustc-check-cfg` directive otherwise you risk having warnings like this: `unexpected cfg condition name: has_foo`.
84+
> Each `cargo::rustc-cfg` should have an accompanying **unconditional** `cargo::rustc-check-cfg` directive to avoid warnings like this: `unexpected cfg condition name: has_foo`.
8585
8686
### Equivalence table
8787

@@ -100,11 +100,11 @@ More details can be found in the [`rustc` book](https://doc.rust-lang.org/nightl
100100

101101
### Can it be disabled?
102102

103-
The feature is **always on** and _cannot_ be disabled from Cargo, but like any other lints it can be controlled: `#![warn(unexpected_cfgs)]`.
103+
For Cargo users, the feature is **always on** and _cannot_ be disabled, but like any other lints it can be controlled: `#![warn(unexpected_cfgs)]`.
104104

105105
### Does the lint affect dependencies?
106106

107-
No, the lint only affects local packages; only those will report the lint.
107+
No, like most lints, `unexpected_cfgs` will only be reported for local packages thanks to [cap-lints](https://doc.rust-lang.org/rustc/lints/levels.html#capping-lints).
108108

109109
### How does it interact with the `RUSTFLAGS` env?
110110

0 commit comments

Comments
 (0)