Applied Intermediate
13 Combinators
Most match statements on Option have a one-word replacement. Transform the inside of an Option with map, then fold a whole parse-with-default flow into a single chain.
In first_upper, uppercase the first character if there is one -- map, no match.
Hints
s.chars().next()is theOption<char>you start from..map(|c| c.to_ascii_uppercase())transforms the inside without unwrapping.
Reveal solution
fn first_upper(s: &str) -> Option<char> {
s.chars().next().map(|c| c.to_ascii_uppercase())
}