Hide Test-Only Helpers

RUST-HIDE-TEST-ONLY-HELPERS

Summary

Keep fixtures and shortcuts behind test-only modules, features, or support crates unless they are deliberate API. This prevents scaffolding from leaking into production contracts.

Rule

Keep test-only helpers out of the normal public API.

Why

Test-only helpers should not become production API or crate-wide concepts by accident. Keeping them behind #[cfg(test)], in test modules, or in test support crates prevents callers and docs from depending on scaffolding.

Helps

Helps keep normal APIs free of fixtures, shortcuts, and constructors that exist only to make tests convenient.

Limits

Expose test support deliberately when downstream users need it, such as a test-support feature, fixtures crate, or documented integration-testing helper.

Agent Instruction

Keep test-only helpers out of the normal public API because test-only helpers should not become
production API or crate-wide concepts by accident.

Mechanisms

Put helpers under #[cfg(test)], dev-dependencies, integration-test modules, or explicitly named test-support features instead of normal public modules.

References