I am new to rust and cannot figure out why I can not collect after map:
fn spin_words(words: &str) -> String {
let split = words.split(" ");
let mut spinned: Vec<&str> = split
.into_iter()
.map(|x: &str| {
if (x.len() >= 5) {
x.to_string()
.chars()
.rev()
.collect::<String>()
.push_str(" ")
} else {
x.to_string().push_str(" ")
}
})
.collect();
//just returning empty string for the compiler
"".to_string()
}