hyperledger-iroha / iroha

Iroha - A simple, enterprise-grade decentralized ledger
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
438 stars 280 forks source link

`#[cfg(coverage)]` never worked? #5139

Closed 0x009922 closed 2 weeks ago

0x009922 commented 2 weeks ago

There are #![cfg(not(coverage))] across *_derive::ui tests. It caused compiler warnings (part of #4993).

warning: unexpected `cfg` condition name: `coverage`
 --> crates/iroha_config_base_derive/tests/ui.rs:1:12
  |
1 | #![cfg(not(coverage))]
  |            ^^^^^^^^
  |
  = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
  = help: consider using a Cargo feature instead

See https://github.com/hyperledger/iroha/pull/5135#discussion_r1791385802

0x009922 commented 2 weeks ago

Actually I found this line in the logs:

info: cargo-llvm-cov currently setting cfg(coverage) and cfg(coverage_nightly); you can opt-out it by passing --no-cfg-coverage and --no-cfg-coverage-nightly

So this is okay to put cfg(coverage) in the lints and there is no issue with it.