committed by
Jakob Stoklund Olesen
parent
cf5701b137
commit
b23f1fb347
@@ -6,9 +6,9 @@ use std::io::{Result, Read};
|
||||
|
||||
/// Read an entire file into a string.
|
||||
pub fn read_to_string<P: AsRef<Path>>(path: P) -> Result<String> {
|
||||
let mut file = try!(File::open(path));
|
||||
let mut file = File::open(path)?;
|
||||
let mut buffer = String::new();
|
||||
try!(file.read_to_string(&mut buffer));
|
||||
file.read_to_string(&mut buffer)?;
|
||||
Ok(buffer)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user