hypervisor: emulator: use matches!
No functional change. Just make the code a bit nicer to read.
@@ -28,14 +28,11 @@ fn get_op<T: CpuStateManager>(
)));
}
- match op_size {
- 1 | 2 | 4 | 8 => {}
- _ => {
+ 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<T: CpuStateManager>(
)));
}
- match op_size {
- 1 | 2 | 4 | 8 => {}
- _ => {
+ if !matches!(op_size, 1 | 2 | 4 | 8) {
return Err(PlatformError::InvalidOperand(anyhow!(
"Invalid operand size {:?}",
op_size
- )))
- }
+ )));
}
match insn
