Group Private Imports Before Public Re-Exports

RUST-GROUP-PRIVATE-IMPORTS-BEFORE-PUBLIC-RE-EXPORTS

Summary

Separate implementation imports from public re-exports in module prologues. The grouping lets readers distinguish internal dependencies from the API surface being presented.

Rule

Group private imports before public re-exports.

Why

Private imports and public re-exports answer different questions. Grouping private use statements before pub use exports lets readers separate implementation dependencies from the crate or module API being presented.

Helps

Helps separate implementation dependencies from the public discovery surface exposed through pub use.

Limits

Small modules can keep imports together when there is no meaningful public surface. Split once re-exports start acting as API documentation.

Agent Instruction

Group private imports before public re-exports because private imports and public re-exports answer
different questions.

Mechanisms

Place private use statements before public pub use groups, add a blank line between groups, and keep re-export lists intentional and reviewable.

References