title: How do I specify a type that cannot be inferred when using if let?
body: <p>I want to write the following with <code>if let</code> but <code>Ok(config)</code> does not provide the type for <code>toml::from_str</code></p>
  
  <pre><code>let result: Result&lt;Config, _&gt; = toml::from_str(content.as_str());
  match result {
      Ok(config) =&gt; {}
      _ =&gt; {}
  }
  
  // if let Ok(config) = toml::from_str(content.as_str()) {
  //    
  // }
  </code></pre>
  
  <p>I tried <code>Ok(config: Config)</code> without luck. The success type is not inferred.</p>