Closed
Description
What it does
Disallows usage of any conditional compilation that always excludes code from test builds.
Advantage
- Prevents code being excluded from tests builds. Preventing the case where a codebase appears to have 100% coverage while having untested code.
- Enforces simplicity in testing, guarding against excessive mocking anti-pattern.
Drawbacks
- May prevent rare legitimate use cases for excluding code from test runs.
Example
The following would trigger this lint:
#[cfg(not(test))]
#[cfg(all(debug_assertions, not(test)))]
#[cfg(not(any(not(debug_assertions), test)))]