Skip to content

Commit

Permalink
Update file-io.md (#561)
Browse files Browse the repository at this point in the history
remove unless mut.
  • Loading branch information
yjhmelody authored and miketang84 committed Jan 26, 2018
1 parent 7bedfac commit 2755188
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions io/file-io.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ fn create_file(filename: &str, buf: &[u8]) -> io::Result<()> {
}

// read from file to String
fn read_file(filename: &str, mut buf: &mut String) -> io::Result<()> {
fn read_file(filename: &str, buf: &mut String) -> io::Result<()> {
let mut f = try!(File::open(filename));
try!(f.read_to_string(&mut buf));
try!(f.read_to_string(&buf));
Ok(())
}

Expand Down

0 comments on commit 2755188

Please sign in to comment.