title: Why does `name = *name.trim();` give me `expected struct `std::string::String`, found str`?
body: <p>Consider the example (does not build):</p>
  
  <pre><code>use std::io::{self, Write};
  
  fn main() {
      io::stdout().write(b"Please enter your name: ");
      io::stdout().flush();
      let mut name = String::new();
      io::stdin().read_line(&amp;mut name);
      name = *name.trim();
      println!("Hello, {}!", name);
  }
  </code></pre>
  
  <p>Why do I get the following error?</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0308]: mismatched types
   --&gt; src/main.rs:8:12
    |
  8 |     name = *name.trim();
    |            ^^^^^^^^^^^^ expected struct `std::string::String`, found str
    |
    = note: expected type `std::string::String`
    = note:    found type `str`
  </code></pre>