← Rule catalog

Structure · Maintainability

Function exceeding its complexity threshold

rust_doctor::structure::complex_function

Split the branching into smaller functions, or flatten it with early returns, so one reading holds the whole path.

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

Not a defect when

The function is a flat dispatch, such as one large match mapping each enum variant or opcode to a single call, whose branch count is high but whose every path reads independently.

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::complex_function=off .
rust-doctor --rule rust_doctor::structure::complex_function=error .

Set it once in rust-doctor.toml

Other Maintainability rules