From 2f57d1c3f965b3aa7c879488e1725b9ea58f6a5f Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 19 Oct 2021 15:01:42 +0100 Subject: [PATCH] hypervisor: mshv: Use assert!() rather than if+panic As identified by the new beta clippy. Signed-off-by: Rob Bradford --- hypervisor/src/mshv/mod.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hypervisor/src/mshv/mod.rs b/hypervisor/src/mshv/mod.rs index 071d33d4b..30a79ae1b 100644 --- a/hypervisor/src/mshv/mod.rs +++ b/hypervisor/src/mshv/mod.rs @@ -342,12 +342,14 @@ impl cpu::Vcpu for MshvVcpu { _ => {} } - if unsafe { access_info.__bindgen_anon_1.string_op() } == 1 { - panic!("String IN/OUT not supported"); - } - if unsafe { access_info.__bindgen_anon_1.rep_prefix() } == 1 { - panic!("Rep IN/OUT not supported"); - } + assert!( + !(unsafe { access_info.__bindgen_anon_1.string_op() } == 1), + "String IN/OUT not supported" + ); + assert!( + !(unsafe { access_info.__bindgen_anon_1.rep_prefix() } == 1), + "Rep IN/OUT not supported" + ); if is_write { let data = (info.rax as u32).to_le_bytes();