Closed ventaquil closed 1 year ago
Describe the bug
I am conditionally add no_coverage attribute only if --cfg tarpaulin is set.
no_coverage
--cfg tarpaulin
#[cfg_attr(tarpaulin, no_coverage)] mod info;
It's not working but putting just #[no_coverage] works as expected.
#[no_coverage]
To Reproduce
#[cfg_attr(tarpaulin, no_coverage)]
cargo tarpaulin
Expected behavior
Item should be ignored from coverage.
Live example
Check my ferric-bytes/chksum-build repo - specially code below.
ferric-bytes/chksum-build
https://github.com/ferric-bytes/chksum-build/blob/299e286ddfea98edc0687d63c8959ce7e3ebd264/src/lib.rs#L178-L179
Possible fix
As far as I understand some extra checks should be added to this function.
https://github.com/xd009642/tarpaulin/blob/343e912bf33a3872ff9f49d48686831d7ca701da/src/source_analysis/attributes.rs#L35-L73
I've just opened a PR which should fix this, if it does I'll likely do a new release once it's merged in :tada:
Describe the bug
I am conditionally add
no_coverage
attribute only if--cfg tarpaulin
is set.It's not working but putting just
#[no_coverage]
works as expected.To Reproduce
#[cfg_attr(tarpaulin, no_coverage)]
.cargo tarpaulin
.#[no_coverage]
.cargo tarpaulin
.Expected behavior
Item should be ignored from coverage.
Live example
Check my
ferric-bytes/chksum-build
repo - specially code below.https://github.com/ferric-bytes/chksum-build/blob/299e286ddfea98edc0687d63c8959ce7e3ebd264/src/lib.rs#L178-L179
Possible fix
As far as I understand some extra checks should be added to this function.
https://github.com/xd009642/tarpaulin/blob/343e912bf33a3872ff9f49d48686831d7ca701da/src/source_analysis/attributes.rs#L35-L73