3 ms·
Don’t know Rust, but wouldn’t this have to be: (Some(x), Some(y)) => Some(x + y) else => None
by dullcrisp 4y ago
Don’t know Rust, but wouldn’t this have to be:
(Some(x), Some(y)) => Some(x + y)
else => None
- deleted 4y ago[deleted]
- steveklabnik 4y agoYou're correct, except that "else" is a keyword and so cannot be used there. You'd want _ => None, instead, which is the "catch all" arm. (For those that didn't catch it, the parent code is trying to use None, but it's actually a tuple, and there's four different cases here, not two. So the catch-all arm is better than spelling each of them out in this case.)
- adwn 4y agoYou're right – fixed. That's what I get from writing code in a simple text area.
- deleted 4y ago[deleted]