Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit 449dba5

Browse files
authored
Merge pull request #958 from udan11/patch-1
Use the '?' operator instead of 'try!'
2 parents 01353a0 + 95b7079 commit 449dba5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

en-US/faq.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,9 +853,8 @@ use std::io::Read;
853853
use std::fs::File;
854854

855855
fn read_file(path: &str) -> Result<String, std::io::Error> {
856-
let mut f = try!(File::open(path));
857856
let mut s = String::new();
858-
try!(f.read_to_string(&mut s)); // `s` contains the contents of "foo.txt"
857+
let _ = File::open(path)?.read_to_string(&mut s); // `s` contains the contents of "foo.txt"
859858
Ok(s)
860859
}
861860

0 commit comments

Comments
 (0)