From a806f586a6734680630a605abdc74a622845d7fa Mon Sep 17 00:00:00 2001 From: xunilrj Date: Wed, 1 Nov 2023 13:44:03 +0000 Subject: [PATCH] improving readability of two matches expr --- .../asm_generation/fuel/fuel_asm_builder.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs b/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs index 7a3491d767a..41b828d37ef 100644 --- a/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs +++ b/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs @@ -1167,12 +1167,6 @@ impl<'ir, 'eng> FuelAsmBuilder<'ir, 'eng> { let instr_reg = self.reg_seqr.next(); match byte_len { - 0 | 2..=7 => { - return Err(CompileError::Internal( - "Attempt to load {byte_len} bytes sized value.", - owning_span.unwrap_or_else(Span::dummy), - )); - } 1 => { self.cur_bytecode.push(Op { opcode: Either::Left(VirtualOp::LB( @@ -1195,6 +1189,12 @@ impl<'ir, 'eng> FuelAsmBuilder<'ir, 'eng> { owning_span, }); } + _ => { + return Err(CompileError::Internal( + "Attempt to load {byte_len} bytes sized value.", + owning_span.unwrap_or_else(Span::dummy), + )); + } } self.reg_map.insert(*instr_val, instr_reg); @@ -1661,12 +1661,6 @@ impl<'ir, 'eng> FuelAsmBuilder<'ir, 'eng> { let val_reg = self.value_to_register(stored_val)?; match byte_len { - 0 | 2..=7 => { - return Err(CompileError::Internal( - "Attempt to load {byte_len} bytes sized value.", - owning_span.unwrap_or_else(Span::dummy), - )); - } 1 => { self.cur_bytecode.push(Op { opcode: Either::Left(VirtualOp::SB( @@ -1689,6 +1683,12 @@ impl<'ir, 'eng> FuelAsmBuilder<'ir, 'eng> { owning_span, }); } + _ => { + return Err(CompileError::Internal( + "Attempt to load {byte_len} bytes sized value.", + owning_span.unwrap_or_else(Span::dummy), + )); + } } Ok(())