From 9d36cc8f131260f01c881093873fa8bf7f95ace7 Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Wed, 10 Jul 2024 15:49:48 +0100 Subject: [PATCH] Fix cargo clippy feedback. --- src/backend/semtech_udp/mod.rs | 20 +++++++++++++++----- src/metadata.rs | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/backend/semtech_udp/mod.rs b/src/backend/semtech_udp/mod.rs index db29e06..490618f 100644 --- a/src/backend/semtech_udp/mod.rs +++ b/src/backend/semtech_udp/mod.rs @@ -388,11 +388,21 @@ async fn handle_push_data(state: &Arc, data: &[u8], remote: &SocketAddr) let s = state.export_stats().await?; stats.rx_packets_received_ok = s.rx_packets_received_ok; stats.tx_packets_emitted = s.tx_packets_emitted; - stats.rx_packets_per_frequency = s.rx_packets_per_frequency.clone(); - stats.tx_packets_per_frequency = s.tx_packets_per_frequency.clone(); - stats.rx_packets_per_modulation = s.rx_packets_per_modulation.clone(); - stats.tx_packets_per_modulation = s.tx_packets_per_modulation.clone(); - stats.tx_packets_per_status = s.tx_packets_per_status.clone(); + stats + .rx_packets_per_frequency + .clone_from(&s.rx_packets_per_frequency); + stats + .tx_packets_per_frequency + .clone_from(&s.tx_packets_per_frequency); + stats + .rx_packets_per_modulation + .clone_from(&s.rx_packets_per_modulation); + stats + .tx_packets_per_modulation + .clone_from(&s.tx_packets_per_modulation); + stats + .tx_packets_per_status + .clone_from(&s.tx_packets_per_status); stats.metadata.extend(metadata::get().await?); send_gateway_stats(&stats).await?; diff --git a/src/metadata.rs b/src/metadata.rs index 4d98e96..cd90e59 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -17,8 +17,8 @@ pub fn setup(conf: &Configuration) -> Result<()> { let mut metadata_w = metadata.write().unwrap(); let mut commands_w = commands.write().unwrap(); - *metadata_w = conf.metadata.r#static.clone(); - *commands_w = conf.metadata.commands.clone(); + metadata_w.clone_from(&conf.metadata.r#static); + commands_w.clone_from(&conf.metadata.commands); Ok(()) }