Rust

Rust

By DeepSource

Using .join(..) with empty string RS-W1203

Anti-pattern

Using slice::join with an empty string literal is equivalent to slice::concat. The latter is more readable and generally more performant. Consider using .concat() over .join("").

Examples

Bad practice

println!("{}", ["hell", "ope"].join(""));
// "hellope"

Recommended

println!("{}", ["hell", "ope"].concat());
// "hellope"