I wanted to take a second look at a StringBuilder as I think it might be more appropriate in Rust than simple string concatenation
So I agree with the instinct that something StringBuilder-ish would be more appropriate in Rust, but there’s already concat! and the concat and join methods on slices. Maybe we just need to make it easier to find those and know how to use them? For instance,
collection_of_strings.into_iter().filter(no_russian)
.collect::<StringBuilder>().to_string()
translates directly to
collection_of_strings.into_iter().filter(no_russian)
.collect::<Vec(String)>().concat()
and we could easily add some shorthand for that:
let foo : String = collection_of_strings.into_iter().filter(no_russian).collect();
and maybe even
let foo = collection_of_strings.into_iter().filter(no_russian).join(", ");
I think that would usually be more ergonomic than StringBuilder.
(Semi-tangential rant: The SliceConcatExt documentation makes it sound like everything on that page, including the methods, is unstable, but if you read issue #27747 you discover that the methods are stable, but the existence of the trait is considered to be an inappropriately exposed implementation detail and instability has been used to discourage people from referring to it directly. This needs to be fixed. Giving the wrong impression unless you already know what’s going on is textbook Bad Documentation.)