From 61b44d0d260b705956c76762d86cbd349f10dcb3 Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Fri, 28 Jun 2024 10:42:38 +0300 Subject: [PATCH] clippy --- src/patch/device.rs | 4 ++-- src/patch/peripheral.rs | 2 ++ src/patch/register.rs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/patch/device.rs b/src/patch/device.rs index 5136c56..b66a81f 100644 --- a/src/patch/device.rs +++ b/src/patch/device.rs @@ -410,9 +410,9 @@ impl DeviceExt for Device { .enumerate() .find(|(_, f)| f.name == pnew) .ok_or_else(|| anyhow!("peripheral {pnew} not found"))?; - d.name = new.name.clone(); + d.name.clone_from(&new.name); d.base_address = new.base_address; - d.interrupt = new.interrupt.clone(); + d.interrupt.clone_from(&new.interrupt); *new = d; for (i, p) in self.peripherals.iter_mut().enumerate() { if p.derived_from.as_deref() == Some(pold) { diff --git a/src/patch/peripheral.rs b/src/patch/peripheral.rs index 18435c3..0cde9b4 100644 --- a/src/patch/peripheral.rs +++ b/src/patch/peripheral.rs @@ -132,6 +132,7 @@ pub(crate) trait RegisterBlockExt: Name { fn get_mut_reg(&mut self, name: &str) -> Option<&mut Register>; /// Register/cluster block + #[allow(unused)] fn children(&self) -> Option<&Vec>; /// Register/cluster block @@ -402,6 +403,7 @@ pub(crate) trait RegisterBlockExt: Name { } } /// Work through a register, handling all fields + #[allow(unused)] fn process_register( &mut self, rspec: &str, diff --git a/src/patch/register.rs b/src/patch/register.rs index 436bb56..38ea9e7 100644 --- a/src/patch/register.rs +++ b/src/patch/register.rs @@ -389,7 +389,7 @@ impl RegisterExt for Register { for f in fields.iter_mut() { if names.contains(&f.name) { if first { - desc = f.description.clone(); + desc.clone_from(&f.description); first = false; } bitwidth += f.bit_range.width;