Skip to content

Commit 5e11aa0

Browse files
committed
Unwrap cfg attribute
1 parent 9571d4d commit 5e11aa0

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/conditional-compilation.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,22 +326,16 @@ r[cfg.attr.syntax]
326326
<!-- should we say they're active attributes here? -->
327327

328328
r[cfg.attr.general]
329-
The `cfg` [attribute] conditionally includes the thing it is attached to based
330-
on a configuration predicate.
329+
The `cfg` [attribute] conditionally includes the thing it is attached to based on a configuration predicate.
331330

332331
r[cfg.attr.syntax-explanation]
333332
It is written as `cfg`, `(`, a configuration predicate, and finally `)`.
334333

335334
r[cfg.attr.effect]
336-
If the predicate is true, the thing is rewritten to not have the `cfg` attribute
337-
on it. If the predicate is false, the thing is removed from the source code.
335+
If the predicate is true, the thing is rewritten to not have the `cfg` attribute on it. If the predicate is false, the thing is removed from the source code.
338336

339337
r[cfg.attr.crate-level-attrs]
340-
When a crate-level `cfg` has a false predicate, the behavior is slightly
341-
different: any crate attributes preceding the `cfg` are kept, and any crate
342-
attributes following the `cfg` are removed. This allows `#![no_std]` and
343-
`#![no_core]` crates to avoid linking `std`/`core` even if a `#![cfg(...)]` has
344-
removed the entire crate.
338+
When a crate-level `cfg` has a false predicate, the behavior is slightly different: any crate attributes preceding the `cfg` are kept, and any crate attributes following the `cfg` are removed. This allows `#![no_std]` and `#![no_core]` crates to avoid linking `std`/`core` even if a `#![cfg(...)]` has removed the entire crate.
345339

346340
Some examples on functions:
347341

0 commit comments

Comments
 (0)