hypervisor: emulator: use matches!

No functional change. Just make the code a bit nicer to read.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2022-06-23 08:29:52 +00:00 committed by Sebastien Boeuf
parent 92f559f6f2
commit 2f514523dd

View File

@ -28,14 +28,11 @@ fn get_op<T: CpuStateManager>(
))); )));
} }
match op_size { if !matches!(op_size, 1 | 2 | 4 | 8) {
1 | 2 | 4 | 8 => {} return Err(PlatformError::InvalidOperand(anyhow!(
_ => { "Invalid operand size {:?}",
return Err(PlatformError::InvalidOperand(anyhow!( op_size
"Invalid operand size {:?}", )));
op_size
)))
}
} }
let value = match insn let value = match insn
@ -81,14 +78,11 @@ fn set_op<T: CpuStateManager>(
))); )));
} }
match op_size { if !matches!(op_size, 1 | 2 | 4 | 8) {
1 | 2 | 4 | 8 => {} return Err(PlatformError::InvalidOperand(anyhow!(
_ => { "Invalid operand size {:?}",
return Err(PlatformError::InvalidOperand(anyhow!( op_size
"Invalid operand size {:?}", )));
op_size
)))
}
} }
match insn match insn