From f865f4744d38a4c209685e0fa1f4955e44986e30 Mon Sep 17 00:00:00 2001 From: guoweikang Date: Wed, 27 Mar 2024 14:25:32 +0800 Subject: [PATCH] clippy: fix clippy warning -------- Signed-off-by: guoweikang --- crates/arm_gic/src/gic_v3.rs | 6 +++--- crates/arm_gic/src/lib.rs | 9 +++------ crates/arm_gic/src/sysregs.rs | 4 ++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/crates/arm_gic/src/gic_v3.rs b/crates/arm_gic/src/gic_v3.rs index d0a1312fa4..fdd5332072 100644 --- a/crates/arm_gic/src/gic_v3.rs +++ b/crates/arm_gic/src/gic_v3.rs @@ -117,7 +117,7 @@ impl GicDistributor { fn validate_dist_version(&self) { let pidr2 = self.regs().PIDR2.get() & Self::GIC_PIDR2_ARCH_MASK; match pidr2 { - Self::GIC_PIDR2_ARCH_GICV3 | Self::GIC_PIDR2_ARCH_GICV4 => return, + Self::GIC_PIDR2_ARCH_GICV3 | Self::GIC_PIDR2_ARCH_GICV4 => (), _ => panic!("unvalid gic pidr2") } } @@ -434,7 +434,7 @@ impl GenericArmGic for GicV3 { /// Enables the interrupt with the given ID. fn enable_interrupt(&mut self, intid: IntId) { - let index = (intid.0 / 32) as usize; + let index = intid.0 / 32; let bit = 1 << (intid.0 % 32); if intid.is_private() { @@ -445,7 +445,7 @@ impl GenericArmGic for GicV3 { } fn disable_interrupt(&mut self, intid: IntId) { - let index = (intid.0 / 32) as usize; + let index = intid.0 / 32; let bit = 1 << (intid.0 % 32); if intid.is_private() { diff --git a/crates/arm_gic/src/lib.rs b/crates/arm_gic/src/lib.rs index ddddd0e825..ecf87fef23 100644 --- a/crates/arm_gic/src/lib.rs +++ b/crates/arm_gic/src/lib.rs @@ -211,12 +211,9 @@ pub trait GenericArmGic: Debug + Clone + Copy + Sync + Send + Sized { F: FnOnce(u32), { let intid = self.get_and_acknowledge_interrupt(); - match intid { - Some(id) => { - handler(id.into()); - self.end_interrupt(id); - } - None => (), + if let Some(id) = intid { + handler(id.into()); + self.end_interrupt(id); } } } diff --git a/crates/arm_gic/src/sysregs.rs b/crates/arm_gic/src/sysregs.rs index 0868c07408..79539393f4 100644 --- a/crates/arm_gic/src/sysregs.rs +++ b/crates/arm_gic/src/sysregs.rs @@ -3,7 +3,7 @@ macro_rules! read_sysreg { { let mut value: u64; ::core::arch::asm!( - concat!("mrs {value:x}, ", ::core::stringify!($name)), + concat!("mrs {value}, ", ::core::stringify!($name)), value = out(reg) value, options(nomem, nostack), ); @@ -19,7 +19,7 @@ macro_rules! write_sysreg { { let v: u64 = $value; ::core::arch::asm!( - concat!("msr ", ::core::stringify!($name), ", {value:x}"), + concat!("msr ", ::core::stringify!($name), ", {value}"), value = in(reg) v, options(nomem, nostack), )