Control flow is nested deeper than the configured maximum

tx0/rust:deep-nestingrecommendedwarningmaintainability/complexitydepth fastmaintainability

What it finds

Deeply nested code makes the reader keep every enclosing condition in mind at once. Early returns, ?, let-else and extracted functions flatten it. Each if, match, loop and closure inside a function counts as one level; an else if stays on the level of its if. The first construct beyond the maximum is reported, once per function. The maximum is the parameter max_depth, 5 by default.

From the rule's source, deep_nesting.rs.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/rust:deep-nesting" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/rust:deep-nesting] reason="..."

tx0 explain tx0/rust:deep-nesting shows the same in the terminal. Found a false positive? Report it.