Clippy · Correctness
splitn count of zero or one never splits
clippy::suspicious_splitn
Pass a count of at least 2 to splitn, which with 0 or 1 never splits.
- Category
- Correctness
- Default level
- warn
- Tier
- P1
- Producer
- Clippy
- Diff scope
- line
Not a defect when
The count comes from a shared constant or generic code path where 1 deliberately yields the whole string as a single item for this instance.
What it reads
Clippy, with the compiler behind it. The only pass that compiles.
Tier
Serious: worth interrupting other work for.
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 clippy::suspicious_splitn=off .
rust-doctor --rule clippy::suspicious_splitn=error .