title: How do you test for a specific Rust error?
body: <p>I can find ways to detect if Rust gives me an error,</p>
  
  <pre><code>assert!(fs::metadata(path).is_err())
  </code></pre>
  
  <p><a href="https://users.rust-lang.org/t/idiomatic-way-of-testing-result-t-error/2171/2" rel="noreferrer">source</a></p>
  
  <p>How do I test for a specific error?</p>