title: Result getting unexpected type argument
body: <p>I am attempting to read values from a file in order to create a struct, and I'm getting a weird pair of errors. A super basic implementation of my code:</p>
  
  <pre class="lang-rust prettyprint-override"><code>extern crate itertools;
  
  use itertools::Itertools;
  use std::io::{self, prelude::*, BufReader};
  use std::fs::{self, File};
  
  // The struct I will unpack into
  struct BasicExample {
      a: String,
      b: String,
      c: String,
      d: String,
  }
  
  impl BasicExample {
      pub fn new(a: String, b: String, c: String, d: String} -&gt; Self {
          BasicExample {
              a, b, c, d
          }
      }
  
      // I'm expecting that reading from the config file might fail, so
      // I want to return a Result that can be unwrapped. Otherwise an Err
      // will be returned with contained value being &amp;'static str
      pub fn from_config(filename: &amp;str) -&gt; io::Result&lt;Self, &amp;'static str&gt; {
          let file = File::open(filename).expect("Could not open file");
  
          // read args into a Vec&lt;String&gt;, consuming file
          let args: Vec&lt;String&gt; = read_config(file);
  
          // I transfer ownership away from args here
          let params: Option&lt;(String, String, String, String)&gt; = args.drain(0..4).tuples().next();
  
          // Then I want to match and return, I could probably do if-let here
          // but I don't have my hands around the base concept yet, so I'll 
          // leave that for later
          match params {
              Some((a, b, c, d)) =&gt; Ok(BasicExample::new(a, b, c, d)),
              _ =&gt; Err("Could not read values into struct")
          }
      }
  
      fn read_config(file: File) -&gt; Vec&lt;String&gt; {
          let buf = BufReader::new(file);
  
          buf.lines()
              .map(|l| l.expect("Could not parse line"))
              .collect()
      }
  }
  </code></pre>
  
  <p>Running <code>cargo check</code> to make sure I didn't miss anything, I get the following error:</p>
  
  <pre class="lang-sh prettyprint-override"><code>error[E0107]: wrong number of type arguments: expected 1, found 2
    --&gt; src/lib.rs:37:60
     |
  37 |     pub fn from_config(filename: &amp;str) -&gt; io::Result&lt;Self, &amp;'static str&gt; {
     |                                                            ^^^^^^^^^^^^ unexpected type argument
  
  error: aborting due to previous error
  
  For more information about this error, try `rustc --explain E0107`.
  </code></pre>
  
  <p>Seems a bit odd. <code>io::Result</code> should take <code>&lt;T, E&gt;</code>, and I've given it <code>E</code>, so let's remove that type argument and see what happens:</p>
  
  <pre class="lang-sh prettyprint-override"><code>error[E0308]: mismatched types
    --&gt; src/lib.rs:54:22
     |
  54 |             _ =&gt; Err("Could not read values into AzureAuthentication struct"),
     |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::io::Error`, found reference
     |
     = note: expected type `std::io::Error`
                found type `&amp;'static str`
  
  error: aborting due to previous error
  
  For more information about this error, try `rustc --explain E0308`.
  </code></pre>
  
  <p>For some reason it is really not happy with the <code>E</code> I provided. I'm a complete beginner with rust, so maybe I'm just not sure what I'm looking at. What am I doing wrong here? The <code>itertools</code> ownership trick was borrowed (ha) from <a href="https://stackoverflow.com/a/43658017/7867968">this wonderful answer</a>.</p>
  
  <h2>System Details:</h2>
  
  <ul>
  <li>macOS 10.13.6</li>
  <li>rustc 1.36.0 (a53f9df32 2019-07-03)</li>
  <li>cargo 1.36.0 (c4fcfb725 2019-05-15)</li>
  </ul>