title: Unable to read file contents to string - Result does not implement any method in scope named `read_to_string`
body: <p>I followed the code to open a file from <a href="http://rustbyexample.com/std_misc/file/open.html" rel="noreferrer">Rust by Example</a>:</p>
  
  <pre><code>use std::{env, fs::File, path::Path};
  
  fn main() {
      let args: Vec&lt;_&gt; = env::args().collect();
      let pattern = &amp;args[1];
  
      if let Some(a) = env::args().nth(2) {
          let path = Path::new(&amp;a);
          let mut file = File::open(&amp;path);
          let mut s = String::new();
          file.read_to_string(&amp;mut s);
          println!("{:?}", s);
      } else {
          //do something
      }
  }
  </code></pre>
  
  <p>However, I got a message like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0599]: no method named `read_to_string` found for type `std::result::Result&lt;std::fs::File, std::io::Error&gt;` in the current scope
    --&gt; src/main.rs:11:14
     |
  11 |         file.read_to_string(&amp;mut s);
     |              ^^^^^^^^^^^^^^ method not found in `std::result::Result&lt;std::fs::File, std::io::Error&gt;`
  </code></pre>
  
  <p>What am I doing wrong?</p>