From d260ef20e39ae47bcef53314eb438c726cbfaa37 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 1 Nov 2015 18:02:40 +0100 Subject: [PATCH] Minify Parser.write() --- src/storage/parser.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/storage/parser.rs b/src/storage/parser.rs index 83760e42..ae6198a3 100644 --- a/src/storage/parser.rs +++ b/src/storage/parser.rs @@ -128,18 +128,10 @@ impl Parser where DP: FileDataParser { let (header, data) = tpl; - let h_text = self.headerp.write(&header); - let d_text = self.datap.write(&data); + let h_text = try!(self.headerp.write(&header)); + let d_text = try!(self.datap.write(&data)); - if h_text.is_err() { - return Err(h_text.err().unwrap()); - } - - if d_text.is_err() { - return Err(d_text.err().unwrap()); - } - - Ok(h_text.ok().unwrap() + &d_text.ok().unwrap()[..]) + Ok(h_text + &d_text[..]) } fn divide_text(&self, text: &String) -> Result {