Skip to content

Commit

Permalink
chore: appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
chorman0773 committed Sep 29, 2023
1 parent c391afe commit 5ac6e2a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
8 changes: 2 additions & 6 deletions arch-ops/src/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,10 @@ impl X86RegisterClass {
}

/// Whether or not register numbers >16 can be encoded using REX2 (else use EVEX)
#[allow(clippy::match_like_matches_macro)] // Match is easier to extend
pub fn use_rex2(&self) -> bool {
match self {
Self::ByteRex => true,
Self::Word => true,
Self::Double => true,
Self::Quad => true,
Self::Cr => true,
Self::Dr => true,
Self::ByteRex | Self::Word | Self::Double | Self::Quad | Self::Cr | Self::Dr => true,
_ => false,
}
}
Expand Down
5 changes: 4 additions & 1 deletion arch-ops/src/x86/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ impl X86InstructionMap {

#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
#[non_exhaustive]
#[allow(clippy::manual_non_exhaustive)] // See above
pub enum X86EncodingPrefix {
NoPrefix,
Rex,
Expand Down Expand Up @@ -914,6 +915,8 @@ impl<HasRM, HasReg, HasReg3, HasMask, HasOpcode>
_ => return false, // 2 top bits needs REX2 or EVEX
}

// Match is easier to extend
#[allow(clippy::single_match)]
match self.size {
Some(X86RegisterClass::Zmm) => return false, // Need EVEX
_ => {}
Expand Down Expand Up @@ -1686,7 +1689,7 @@ impl<W: InsnWrite> X86Encoder<W> {
),
))
}
[oprs @ ..] => todo!("{:?}", oprs),
oprs => todo!("{:?}", oprs),
},
X86EncodingMode::ModRMOp2(op) => todo!("{}", op),
X86EncodingMode::OpReg(_) => todo!("+r"),
Expand Down
1 change: 1 addition & 0 deletions binfmt/src/ar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ impl Archive {
}
}

#[allow(clippy::unused_io_amount)] // FIXME: Ray wrote this code. Is this correct?
pub fn ranlib(&mut self) -> &mut ArchiveMember {
if self.symtab.is_none() {
let mut symtab = ArchiveMember::new();
Expand Down
1 change: 1 addition & 0 deletions objdump/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ fn main() {

let mut input_file = None::<String>;

#[allow(clippy::never_loop)] // We need to handle more options than `--version` and `--help`
while let Some(arg) = args.next() {
match &*arg {
"--version" => {
Expand Down

0 comments on commit 5ac6e2a

Please sign in to comment.