title: type mismatch error while reading stdin lines
body: <p>I have no idea why this simple example is not working:</p>
  
  <pre><code>use std::io;
  use std::io::prelude::*;
  
  fn main() {
  
      let stdin = io::stdin();
  
      for line in stdin.lock().lines() {
          match line {
              Ok(val) =&gt; match val {
                  v @ _ =&gt; println!("{:?}", v),
                  "q" =&gt; std::process::exit(0)
              },
              _ =&gt; println!("ERROR")
          }
      }
  
  }
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>src/main.rs:8:5: 16:6 error: type mismatch resolving `&lt;std::io::Lines&lt;std::io::stdio::StdinLock&lt;'_&gt;&gt; as core::iter::Iterator&gt;::Item == core::result::Result&lt;&amp;str, _&gt;`:
   expected struct `collections::string::String`,
      found &amp;-ptr [E0271]
  src/main.rs: 8     for line in stdin.lock().lines() {
  src/main.rs: 9         match line {
  src/main.rs:10             Ok(val) =&gt; match val {
  src/main.rs:11                 v @ _ =&gt; println!("{:?}", v),
  src/main.rs:12                 "q" =&gt; std::process::exit(0)
  src/main.rs:13             },
                 ...
  </code></pre>
  
  <p>I'm just trying to echo stdin lines entered and exit the application if the line equals "q".</p>