My first thought is the map Option , but I cannot use try! from inside closure. The match statement seems unnecessary, but I cannot figure out how to simplify it.
fn example<T, E>(val: Option<Result<T, E>>) -> Result<Option<T>, E> { Ok(match val { Some(v) => Some(v?), None => None }) }
source share