.chars().filter(..)
RS-W1049Using .chars().filter(..)
requires additional logic and complexity compared to using .matches(..)
Using matches(..)
allows for much greater flexibility such as using Pattern
trait bound types,
and matching string expressions directly.
"a b c".chars().filter(|x| *x != ' ').collect::<Vec<char>>();
// ['a', 'b', 'c']
"a b c".matches(|x| x != ' ').collect::<Vec<&str>>();
// ["a", "b", "c"]