title: Mismatched types: expected &str found String when assigning string
body: <p>I'm trying to assign variable value (type <code>String</code>) based on the number of args:</p>
  
  <pre><code>let mut out_filename = "";
  let args: Vec&lt;_&gt; = env::args().collect();
  match args.len() {
      2 =&gt; out_filename = args[1],
      3 =&gt; out_filename = args[2],
      _ =&gt; panic!("To many params !"),
  };
  </code></pre>
  
  <p>And I'm getting </p>
  
  <pre class="lang-none prettyprint-override"><code>src/main.rs:39:29: 39:36 error: mismatched types:
   expected `&amp;str`,
      found `collections::string::String`
  (expected &amp;-ptr,
      found struct `collections::string::String`) [E0308]
  src/main.rs:39         2 =&gt; out_filename = args[1],
  </code></pre>
  
  <p>How to make a match statement where the match value (1,2,3) is just a selector and the returned type is different?  There is no <code>let var = match</code> ..</p>