Re:Rust: A Critical Retrospective
by gardaani on Thursday May 19, 2022 @12:36PM
(#31436856)
Early exit code would be easier to write if Rust supported guard let.
[ Parent
| on HN ]
Re:Rust: A Critical Retrospective
by veber-alex on Thursday May 19, 2022 @01:55PM
(#31437937)
its coming soon, already available on nightly.
let Some(x) = foo() else { return 42 };
Re:Rust: A Critical Retrospective
by inferiorhuman on Thursday May 19, 2022 @10:21PM
(#31442627)
I'd suggest that something like that is already achievable by having foo return an Option and combining it with unwrap_or.