vmm: Avoid clippy bool simplification warning

Clippy misidentifies this code as having a boolean expression that can
be simplified:

error: this boolean expression can be simplified
Error:    --> vmm/src/cpu.rs:425:13
    |
425 |             is_aarch64_feature_detected!("sve") || is_aarch64_feature_detected!("sve2");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
    = note: `-D clippy::nonminimal-bool` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
help: try
    |
425 |             !(!cfg!(target_feature = $target_feature_lit) && !$crate::detect::__is_feature_detected::$feature() && !$crate::detect::__is_feature_detected::$feature());
    |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
425 |             is_aarch64_feature_detected!("sve") || is_aarch64_feature_detected!("sve") || is_aarch64_feature_detected!("sve2");
    |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
Rob Bradford 2024-09-07 09:53:41 +01:00
parent 60c8a72e29
commit e47677020e

View File

@ -421,6 +421,7 @@ impl Vcpu {
pub fn init(&self, vm: &Arc<dyn hypervisor::Vm>) -> Result<()> {
use std::arch::is_aarch64_feature_detected;
let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default();
#[allow(clippy::nonminimal_bool)]
let sve_supported =
is_aarch64_feature_detected!("sve") || is_aarch64_feature_detected!("sve2");
// This reads back the kernel's preferred target type.