Hacker News new | ask | show | jobs
by dullcrisp 1255 days ago
Don’t know Rust, but wouldn’t this have to be:

    (Some(x), Some(y)) => Some(x + y)
    else => None
2 comments

You'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.)

You're right – fixed. That's what I get from writing code in a simple text area.
Your "fixed" version is also broken (at time of writing). :-)
Fixed again. I'm starting to run out of excuses... ;-)