title: What is the idiomatic way to return an error from a function with no result if successful?
body: <p>In Rust, I believe the idiomatic way to deal with recoverable errors is to use Result. For example this function clearly is idiomatic:</p>
  
  <pre><code>fn do_work() -&gt; Result&lt;u64, WorkError&gt; {...}
  </code></pre>
  
  <p>Of course, there are also functions that have a single, obvious, failure state, and therefore use the Option type instead. An idiomatic example would be this:</p>
  
  <pre><code>fn do_work() -&gt; Option&lt;u64&gt;
  </code></pre>
  
  <p>This all is straightforwardly addressed in the documentation. However, I'm confused about the case where a function can fail, but has no meaningful value when successful. Compare the following two functions:</p>
  
  <pre><code>fn do_work() -&gt; Option&lt;WorkError&gt;
  // vs
  fn do_work() -&gt; Result&lt;(), WorkError&gt;
  </code></pre>
  
  <p>I'm just not sure which one of these is more idiomatic, or is used more often in real world Rust code. My go-to resource for questions like this is the Rust book, but I don't think this is addressed in its "<a href="https://doc.rust-lang.org/book/error-handling.html">Error Handling</a>" section. I haven't had much luck with any other Rust documentation either.</p>
  
  <p>Of course this seems pretty subjective, but I'm looking for authoritative sources that either state which form is idiomatic, or on why one form is superior (or inferior) to the other. (I'm also curious how the convention compares to other languages that heavily utilize "errors as values", like Go and Haskell.)</p>