From bb86934b5381094f4b6fd8a4ef1800f58655cc58 Mon Sep 17 00:00:00 2001 From: Natapat Samutpong Date: Thu, 27 Jan 2022 12:44:11 +0700 Subject: [PATCH] refactor: fold brackets --- blspc/src/vm/vm.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/blspc/src/vm/vm.rs b/blspc/src/vm/vm.rs index ecb39a2..d962daf 100644 --- a/blspc/src/vm/vm.rs +++ b/blspc/src/vm/vm.rs @@ -39,14 +39,10 @@ impl VM { pub fn run(&mut self, instrs: Vec, debug: bool) -> VMReturn { 'tco: loop { self.instr_pointer += 1; - if self.instr_pointer - 1 == instrs.len() as isize { - return Ok(()); - } + if self.instr_pointer - 1 == instrs.len() as isize { return Ok(()); } let instr = &instrs[self.instr_pointer as usize - 1]; - if debug { - println!("ptr: {} | stack: {:?} | curr: {}", self.instr_pointer - 1, &self.stack, &instr); - } + if debug { println!("ptr: {} | stack: {:?} | curr: {}", self.instr_pointer - 1, &self.stack, &instr); } match instr { Store { address, value, .. } => { self.store(&address, &value)?; @@ -97,14 +93,10 @@ impl VM { }, PopJumpIfFalse { to, .. } => { let value = self.stack.pop().unwrap(); - if !value.as_bool() { - self.instr_pointer = *to as isize - 1; - } + if !value.as_bool() { self.instr_pointer = *to as isize - 1; } continue 'tco; }, - Return { .. } => { - return Ok(()); - }, + Return { .. } => return Ok(()), }; } }