Skip to content

Commit 877c630

Browse files
committed
Document how to address unexpected_cfgs
Closes #370
1 parent 985d6f9 commit 877c630

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,13 @@ cfgs are set under the following conditions:
501501
- `cfg(coverage)` is always set when using cargo-llvm-cov (unless `--no-cfg-coverage` flag passed)
502502
- `cfg(coverage_nightly)` is set when using cargo-llvm-cov with nightly toolchain (unless `--no-cfg-coverage-nightly` flag passed)
503503

504+
Rust 1.80+ warns the above cfgs as `unexpected_cfgs`. The recommended way to address this is to add a [`lints` table](https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html#check-cfg-in-lintsrust-table) to `Cargo.toml`.
505+
506+
```toml
507+
[lints.rust]
508+
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(coverage,coverage_nightly)"] }
509+
```
510+
504511
If you want to ignore all `#[test]`-related code, consider using [coverage-helper] crate version 0.2+.
505512

506513
cargo-llvm-cov excludes code contained in the directory named `tests` from the report by default, so you can also use it instead of coverage-helper crate.

0 commit comments

Comments
 (0)