you are viewing a single comment's thread
view the rest of the comments
[–] 1 point 1 year ago (1 child)

That's not an alternative, it's removing let-else entirely. It's equivalent to this:

let i = if let Some(i) = opt_number {
    i
} else {
    return 0;
};

let-else is specifically a feature that allows you to use a refutable pattern to deconstruct a value by providing a diverging else branch.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 1 year ago* (last edited 1 year ago)

    Removing let-else is the whole point of the linked article series:

    Being able to do to everything Rust does, but without Rust's zoo of if-then-else, match, if-let, let-else etc.

  • source
  • parent