From c1a810336795bcd726020695826c9b2cc2d23fa6 Mon Sep 17 00:00:00 2001 From: Phantomical Date: Sun, 11 Feb 2024 12:01:06 -0800 Subject: [PATCH] Fix remaining clippy warnings --- src/decoded_inst.rs | 8 ++++++++ src/macros/wrapper_enum.rs | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/decoded_inst.rs b/src/decoded_inst.rs index d36935d..11ecbf1 100644 --- a/src/decoded_inst.rs +++ b/src/decoded_inst.rs @@ -148,6 +148,10 @@ impl<'a, 'd> OperandValues<'a, 'd> { Self { inst } } + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + pub fn len(&self) -> usize { unsafe { xed_decoded_inst_noperands(self.inst.as_raw()) as usize } } @@ -309,6 +313,10 @@ impl<'d> DecodedInst<'d> { pub struct MemoryOperands<'a, 'd>(OperandValues<'a, 'd>); impl<'a, 'd> MemoryOperands<'a, 'd> { + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + pub fn len(&self) -> usize { unsafe { xed_decoded_inst_number_of_memory_operands(self.0.inst.as_raw()) as usize } } diff --git a/src/macros/wrapper_enum.rs b/src/macros/wrapper_enum.rs index d6cc9be..250c2b5 100644 --- a/src/macros/wrapper_enum.rs +++ b/src/macros/wrapper_enum.rs @@ -187,6 +187,11 @@ pub(crate) const fn is_contiguous(variants: &[c_uint], assert: bool) -> Option<( if !contains(variants, variant) { if assert { let slice: [(); 0] = []; + + // This statement isn't supposed to have an effect. It's just meant to create an + // assertion message that specifies the value of the variant that is contained + // within. + #[allow(clippy::no_effect)] slice[variant as usize]; }