Converts all try! macros to ? syntax.

Fixes #46
This commit is contained in:
rep-nop
2017-02-25 22:12:33 -05:00
committed by Jakob Stoklund Olesen
parent c8be39fa9d
commit 7459fee71a
22 changed files with 270 additions and 270 deletions

View File

@@ -15,14 +15,14 @@ pub fn run(files: Vec<String>) -> CommandResult {
if i != 0 {
println!("");
}
try!(cat_one(f))
cat_one(f)?
}
Ok(())
}
fn cat_one(filename: String) -> CommandResult {
let buffer = try!(read_to_string(&filename).map_err(|e| format!("{}: {}", filename, e)));
let items = try!(parse_functions(&buffer).map_err(|e| format!("{}: {}", filename, e)));
let buffer = read_to_string(&filename).map_err(|e| format!("{}: {}", filename, e))?;
let items = parse_functions(&buffer).map_err(|e| format!("{}: {}", filename, e))?;
for (idx, func) in items.into_iter().enumerate() {
if idx != 0 {