3 ms·
Often such functions can be rewritten to perform some operations "inside" the option. For example: fn is_equal_to_ten(n: Option<u32>) -> bool { n.m
by Thiez 8y ago
Often such functions can be rewritten to perform some operations "inside" the option. For example:
fn is_equal_to_ten(n: Option<u32>) -> bool {
n.map(|n|n == 10).unwrap_or_default()
}