Rust logoRust/
RS-W1208

Found usage of `.repeat(1)`RS-W1208

Minor severityMinor
Anti-pattern categoryAnti-pattern

Using .repeat(1) on &str or String is equivalent to just .to_owned(), which is both more readable and generally more performant.

Consider using .to_owned() over .repeat(1).

Bad practice

let foo = "some_string".repeat(1);
let foo = "some_string".to_owned();