News for hackers. Stuff that matters.
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.
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.
Re:Rust: A Critical Retrospective by klodolph on Thursday May 19, 2022 @01:41PM (#31437738)
Like this?

    if let Ok(x) = my_func() {
        // ...
    }
Or do you mean something else?