← Rule catalog

Structure · Maintainability

Oversized file, function, impl block or module

rust_doctor::structure::oversized_unit

Split the file, function, impl block or module along its responsibilities before growth makes the split harder.

Category
Maintainability
Default level
warn
Tier
P3
Producer
Structure
Diff scope
line

Not a defect when

The unit is generated or data-like, such as a lookup table, a large match over a published enum or a file of independent test cases, where splitting would scatter one cohesive list.

What it reads

Complexity, and families of near-duplicate code.

Tier

Lowest tier: real, and rarely urgent.

The tier bounds how severe a rule may be; its category bounds the tier.

Diff scope

The changed line itself.

What --scope contextual looks at to decide whether a change caused the finding.

Change it

Turn it off, or make it blocking, without touching the code it flags:

rust-doctor --rule rust_doctor::structure::oversized_unit=off .
rust-doctor --rule rust_doctor::structure::oversized_unit=error .

Set it once in rust-doctor.toml

Other Maintainability rules