Rust

Rust

By DeepSource

Found potentially ambiguous use of `.splitn(..)`RS-W1047

Anti-pattern
Has Autofix

Prefer using .split(..) over .splitn(..) when possible, to reduce code complexity. .splitn(..).next() is equivalent to .split(..).next().

Replace the call to .splitn(..).next() with .split(..).next().

Examples

Bad practice

"Mary had a little lambda".splitn(2, ' ').next();

Recommended

"Mary had a little lambda".split(' ').next();