Re:Where Everything Went Wrong: Error Handling and Error Mes...
by danappelxx on Friday February 19, 2021 @03:14PM
(#26197508)
I missed `guard let` for a while too, but eventually stumbled upon this pattern which is almost as good:
let value = match value {
None => return,
Some(value) => value
};
I'm using this in my own code now to unwrap or return (it looks stupid):
[1] https://szymonkrajewski.pl/why-should-you-return-early/[2] https://github.com/rust-lang/rfcs/issues/2616
[3] https://github.com/rust-lang/rfcs/pull/1303