3 ms·
Pretty sure clippy will tell you to rewrite it as: if let (Some(x), Some(y)) = (x, y) { Some(x + y) } else { None } `match` in place
by 0x457 4y ago
Pretty sure clippy will tell you to rewrite it as:
if let (Some(x), Some(y)) = (x, y) {
Some(x + y)
} else {
None
}
`match` in place of `if` looks weird. IMO example with `zip` is better though.
- steveklabnik 4y agoClippy will not complain about the parent's code. It's not really in place of an if; there's four cases there. To be honest, I find 'if let... else None' to be worse looking than the match, though I'm unsure if I truly prefer the zip version to the Some(x? + y?) version.