From 4bb6a5d48851e593419c2b5e6ef156e0ad5392cb Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Sun, 15 Aug 2021 19:42:26 +0200 Subject: [PATCH] Fix clippy --- lib/src/isa.rs | 2 ++ lib/src/lib.rs | 20 ++++++++------------ macros/src/writer.rs | 5 +---- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/lib/src/isa.rs b/lib/src/isa.rs index 352104f..5e47223 100644 --- a/lib/src/isa.rs +++ b/lib/src/isa.rs @@ -1,3 +1,5 @@ +#![allow(clippy::bad_bit_mask)] + use crate::{bit, bits}; use ppc750cl_macros::isa; diff --git a/lib/src/lib.rs b/lib/src/lib.rs index cf4e10e..08d4447 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -502,8 +502,8 @@ impl Ins { }; // TODO avoid string concatenation out.write_mnemonic(&(mnemonic_base.to_owned() + bname))?; - out.write_aa(self.aa())?; out.write_lk(self.lk())?; + out.write_aa(self.aa())?; if bname.is_empty() { out.write_opcode_separator()?; if self.crf_s() != 0 { @@ -511,11 +511,9 @@ impl Ins { out.write_operand_separator()?; } out.write_branch_target(self.bd(), self.addr)?; - } else { - if self.crf_s() != 0 { - out.write_opcode_separator()?; - out.write_cr(self.bi() >> 2)?; - } + } else if self.crf_s() != 0 { + out.write_opcode_separator()?; + out.write_cr(self.bi() >> 2)?; } } } else { @@ -537,8 +535,8 @@ impl Ins { }; // TODO avoid string concatenation out.write_mnemonic(&(mnemonic_base.to_owned() + bname))?; - out.write_aa(self.aa())?; out.write_lk(self.lk())?; + out.write_aa(self.aa())?; if bname.is_empty() { out.write_opcode_separator()?; if (self.bo() & 16) == 0 { @@ -546,11 +544,9 @@ impl Ins { out.write_operand_separator()?; } out.write_branch_target(self.bd(), self.addr)?; - } else { - if (self.bo() & 16) == 0 { - out.write_opcode_separator()?; - out.write_mode(self.bi())?; - } + } else if (self.bo() & 16) == 0 { + out.write_opcode_separator()?; + out.write_mode(self.bi())?; } } Ok(()) diff --git a/macros/src/writer.rs b/macros/src/writer.rs index e495dc7..dc96c3f 100644 --- a/macros/src/writer.rs +++ b/macros/src/writer.rs @@ -57,10 +57,7 @@ impl Parse for Argument { .parse_terminated::(Expr::parse)? .into_iter() .collect(); - } else if lookahead.peek(syn::LitStr) { - let expr = input.parse::()?.into(); - sources = vec![expr]; - } else if lookahead.peek(syn::LitInt) { + } else if lookahead.peek(syn::LitStr) || lookahead.peek(syn::LitInt) { let expr = input.parse::()?.into(); sources = vec![expr]; } else {