Skip to content

Commit

Permalink
Fix remaining clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Phantomical committed Feb 11, 2024
1 parent 6e7ac55 commit c1a8103
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/decoded_inst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
Expand Down Expand Up @@ -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 }
}
Expand Down
5 changes: 5 additions & 0 deletions src/macros/wrapper_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down

0 comments on commit c1a8103

Please sign in to comment.