Let-else syntax feels underwhelming

โš“ rust    ๐Ÿ“… 2025-05-06    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 5      

surdeus

Warning

This post was published 59 days ago. The information described in this article may have changed.

I tried to switch from match to let-else for my error handling, but not having access to the value in the else block severely limits what you can do: I can't log the error, convert it, or match on it.
Things are a bit better with Option, since with None you don't have a value. Still, I try to stick with match for consistency, as alongside you would often have matches on Results, and being consistent is more important than saving a few keystrokes.

While let-else is occasionally useful, the feature often feels underwhelming.
Not saying it isn't useful for othersโ€”just sharing my thoughts.

I'd be interested to hear what others think.

19 posts - 9 participants

Read full topic

๐Ÿท๏ธ rust_feed