News for hackers. Stuff that matters.
Re:Rust: A Critical Retrospective by ntoskrnl on Thursday May 19, 2022 @11:41AM (#31436154)
I do this too, with a different spin on it:

  let foo = match foo() {
      Ok(foo) => foo,
      Err(err) => return Err(err),
  };
I was typing it out so often I made editor aliases `lmo` and `lmr` for Option and Result
Re:Rust: A Critical Retrospective by veber-alex on Thursday May 19, 2022 @11:47AM (#31436224)
let me introduce you to the famous '?' operator.

The code above can be written as:

  let foo = foo()?;
Re:Rust: A Critical Retrospective by ntoskrnl on Thursday May 19, 2022 @11:57AM (#31436325)
LOL you're right! I just pasted the template here, but my defaults are mostly equivalent to plain old `?`. I don't use the match if `?` would work.