|
1 | 1 | # Coverage instrumentation attributes
|
2 | 2 |
|
3 |
| -The following [attributes] are used for controlling coverage instrumentation, |
4 |
| -which can be enabled with the `-C instrument-coverage` compiler flag. |
| 3 | +The following [attributes] are used for controlling coverage instrumentation, which can be enabled with the `-C instrument-coverage` compiler flag. |
5 | 4 |
|
6 | 5 | ### The `coverage` attribute
|
7 | 6 |
|
8 |
| -The *`coverage` [attribute]* indicates whether a function should instrument code |
9 |
| -coverage at all and show up in code coverage reports. It can only be controlled |
10 |
| -at the function level, but it can be applied to modules, `impl` blocks, or |
11 |
| -anything that can contain functions. |
| 7 | +The *`coverage` [attribute]* indicates whether a function should instrument code coverage at all and show up in code coverage reports. It can only be controlled at the function level, but it can be applied to modules, `impl` blocks, or anything that can contain functions. |
12 | 8 |
|
13 | 9 | There are two ways to use the coverage attribute:
|
14 | 10 |
|
15 |
| -* `#[coverage(off)]` indicates that all functions within an item, recursively, |
16 |
| - should not be instrumented, unless specified by another attribute. |
17 |
| -* `#[coverage(on)]` (the default) indicates that all functions within an item, |
18 |
| - recursively, *should* be instrumented, unless specified by another attribute. |
| 11 | +* `#[coverage(off)]` indicates that all functions within an item, recursively, should not be instrumented, unless specified by another attribute. |
| 12 | +* `#[coverage(on)]` (the default) indicates that all functions within an item, recursively, *should* be instrumented, unless specified by another attribute. |
19 | 13 |
|
20 |
| -More-specific attributes always take priority over less-specific ones, e.g. |
21 |
| -if a crate is marked `#![coverage(off)]`, then functions inside that crate |
22 |
| -marked `#[coverage(on)]` will still have coverage. |
| 14 | +More-specific attributes always take priority over less-specific ones, e.g. if a crate is marked `#![coverage(off)]`, then functions inside that crate marked `#[coverage(on)]` will still have coverage. |
23 | 15 |
|
24 | 16 | [attribute]: ../attributes.md
|
25 | 17 | [attributes]: ../attributes.md
|
0 commit comments