diff --git a/hypervisor/src/arch/x86/emulator/instructions/mod.rs b/hypervisor/src/arch/x86/emulator/instructions/mod.rs index 516f8714b..ef10df58f 100644 --- a/hypervisor/src/arch/x86/emulator/instructions/mod.rs +++ b/hypervisor/src/arch/x86/emulator/instructions/mod.rs @@ -28,14 +28,11 @@ fn get_op( ))); } - match op_size { - 1 | 2 | 4 | 8 => {} - _ => { - return Err(PlatformError::InvalidOperand(anyhow!( - "Invalid operand size {:?}", - op_size - ))) - } + if !matches!(op_size, 1 | 2 | 4 | 8) { + return Err(PlatformError::InvalidOperand(anyhow!( + "Invalid operand size {:?}", + op_size + ))); } let value = match insn @@ -81,14 +78,11 @@ fn set_op( ))); } - match op_size { - 1 | 2 | 4 | 8 => {} - _ => { - return Err(PlatformError::InvalidOperand(anyhow!( - "Invalid operand size {:?}", - op_size - ))) - } + if !matches!(op_size, 1 | 2 | 4 | 8) { + return Err(PlatformError::InvalidOperand(anyhow!( + "Invalid operand size {:?}", + op_size + ))); } match insn