RS.CLIPPY.CFG_NOT_TEST
Enforce against excluding code from test builds
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: cfg_not_test. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for usage of cfg that excludes code from test builds. (i.e., #[cfg(not(test))])
Why is this bad?
This may give the false impression that a codebase has 100% coverage, yet actually has untested code. Enabling this also guards against excessive mockery as well, which is an anti-pattern.
Example
#[cfg(not(test))]
important_check(); // I\'m not actually tested, but not including me will falsely increase coverage!
Use instead:
important_check();