Mismatched types in if let statement: found Option expected Result
<p>I am trying to parse a file that has a pipe delimiter between each value and each line is a new record. I am iterating over each line like this:</p>

<pre><code>use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;

fn main() {
    let source_file = File::open("input.txt").unwrap();
    let reader = BufReader::new(source_file);
    for line in reader.lines() {
        if let Some(channel_line) = line {
            println!("yay");
        }
    }
}
</code></pre>

<p><a href="https://play.rust-lang.org/?gist=80b1a9c8a94f1c6665c353015661a016&amp;version=stable" rel="noreferrer">Playground</a></p>

<p>However, I get an error:</p>

<pre class="lang-none prettyprint-override"><code>error[E0308]: mismatched types
  --&gt; src/main.rs:9:20
  |
9 |             if let Some(channel_line) = line {
  |                    ^^^^^^^^^^^^^^^^^^ expected enum    `std::result::Result`, found enum `std::option::Option`
  |
  = note: expected type `std::result::Result&lt;std::string::String, std::io::Error&gt;`
  = note:    found type `std::option::Option&lt;_&gt;`
</code></pre>

<p>This error is confusing to me as the found type is what I expected namely <code>Option&lt;Result&lt;String, Error&gt;&gt;</code> as indicated by the <a href="https://doc.rust-lang.org/std/io/struct.Lines.html#method.next" rel="noreferrer">docs</a> so it would make sense to unwrap the <code>Option</code> before the result assuming I am not missing something. </p>