title: Option types and early returns. return an Error when is_none()
body: <p>Using match (like in <code>bar</code>) seems to be a common approach..</p>
  
  <pre><code>#[derive(Debug)]
  pub enum MyErrors {
      SomeError,
  }
  
  fn foo(x: Option&lt;u64&gt;) -&gt; Result&lt;u64, MyErrors&gt; {
      if x.is_none() {
        return Err(MyErrors::SomeError);
      } 
  
      // .. some long code where more options
      // are checked and matched 
      // The ok here is just so the code is simple and compiles
      Ok(x.unwrap() * 2)
  }
  
  fn bar(x: Option&lt;u64&gt;) -&gt; Result&lt;u64, MyErrors&gt; {
      match x {
          None =&gt; {
              return Err(MyErrors::SomeError)?;
          }
          Some(v) =&gt; {
             // .. some long code where more options
             // are checked and matched 
             // The ok here is just so the code is simple and compiles
             Ok(x.unwrap() * 2)
          }
      }
  }
  
  
  fn main() {
      foo(Some(1));
      bar(Some(2));
  }
  </code></pre>
  
  <p>However, early returns (such as in <code>foo</code>) significantly reduce how nested the code looks like. If there are multiple times when an option has to be unwrapped or an error returned, code like bar gets very nested...</p>
  
  <p>What is the recommended practice for early returning an error in the case of empty options?</p>