From 28582e7acbc279145d1c53e1093752897785c0fd Mon Sep 17 00:00:00 2001 From: debris Date: Thu, 15 Sep 2016 15:36:55 +0200 Subject: [PATCH] removed redundant macro --- src/script/script.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/script/script.rs b/src/script/script.rs index 26ea7d60..615d1cef 100644 --- a/src/script/script.rs +++ b/src/script/script.rs @@ -323,15 +323,6 @@ fn read_usize(data: &[u8], size: usize) -> Result { Ok(result) } -macro_rules! try_or_fmt { - ($fmt: expr, $expr: expr) => { - match $expr { - Ok(o) => o, - Err(e) => return e.fmt($fmt), - } - } -} - impl fmt::Debug for Script { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(&self.data.to_hex()) @@ -343,7 +334,10 @@ impl fmt::Display for Script { let mut pc = 0; while pc < self.len() { - let instruction = try_or_fmt!(f, self.get_instruction(pc)); + let instruction = match self.get_instruction(pc) { + Ok(i) => i, + Err(e) => return e.fmt(f), + }; match instruction.data { Some(data) => try!(writeln!(f, "{:?} 0x{}", instruction.opcode, data.to_hex())),