From 016d4ddfd75cc7408bab435da8bc3a5bb0515ec0 Mon Sep 17 00:00:00 2001 From: Stanislaw Grams Date: Tue, 17 Mar 2026 00:15:03 +0100 Subject: [PATCH] [fix](trx-rs): resolve all clippy warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remote_client tests: add missing server_connected field and import AtomicBool in the test module - pskreporter: replace map_or(true, …) with is_none_or and repeat(x).take(n) with repeat_n(x, n) - dsp.rs, scheduler.rs: suppress intentional too_many_arguments with #[allow(clippy::too_many_arguments)] Co-authored-by: Claude Sonnet 4.6 Signed-off-by: Stanislaw Grams --- src/trx-client/src/remote_client.rs | 3 +++ .../trx-frontend/trx-frontend-http/src/scheduler.rs | 1 + src/trx-reporting/src/pskreporter.rs | 4 ++-- src/trx-server/trx-backend/trx-backend-soapysdr/src/dsp.rs | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/trx-client/src/remote_client.rs b/src/trx-client/src/remote_client.rs index a0742e3..cfe08f5 100644 --- a/src/trx-client/src/remote_client.rs +++ b/src/trx-client/src/remote_client.rs @@ -666,6 +666,7 @@ fn parse_port(port_str: &str) -> Result { #[cfg(test)] mod tests { use super::{parse_remote_url, RemoteClientConfig, RemoteEndpoint, SharedSpectrum}; + use std::sync::atomic::AtomicBool; use std::sync::{Arc, Mutex}; use std::time::Duration; @@ -849,6 +850,7 @@ mod tests { known_rigs: Arc::new(Mutex::new(Vec::new())), poll_interval: Duration::from_millis(100), spectrum: Arc::new(spectrum_tx), + server_connected: Arc::new(AtomicBool::new(false)), }, req_rx, state_tx, @@ -886,6 +888,7 @@ mod tests { known_rigs: Arc::new(Mutex::new(Vec::new())), poll_interval: Duration::from_millis(500), spectrum: Arc::new(spectrum_tx), + server_connected: Arc::new(AtomicBool::new(false)), }; let envelope = super::build_envelope(&config, trx_protocol::ClientCommand::GetState, None); assert_eq!(envelope.token.as_deref(), Some("secret")); diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/scheduler.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/scheduler.rs index 7984659..58b0cee 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/scheduler.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/scheduler.rs @@ -411,6 +411,7 @@ pub struct SchedulerStatus { pub last_bookmark_ids: Vec, } +#[allow(clippy::too_many_arguments)] async fn apply_scheduler_target( rig_tx: &mpsc::Sender, rig_id: &str, diff --git a/src/trx-reporting/src/pskreporter.rs b/src/trx-reporting/src/pskreporter.rs index c493632..13e4a3d 100644 --- a/src/trx-reporting/src/pskreporter.rs +++ b/src/trx-reporting/src/pskreporter.rs @@ -420,7 +420,7 @@ impl PskReporterClient { let include_templates = self.packets_sent < 3 || self .last_template_instant - .map_or(true, |t| t.elapsed() >= Duration::from_secs(TEMPLATE_RESEND_SECS)); + .is_none_or(|t| t.elapsed() >= Duration::from_secs(TEMPLATE_RESEND_SECS)); let packet = self.make_packet(spots, include_templates)?; self.socket @@ -501,7 +501,7 @@ impl PskReporterClient { fn pad_to_4(buf: &mut Vec) { let rem = buf.len() % 4; if rem != 0 { - buf.extend(std::iter::repeat(0u8).take(4 - rem)); + buf.extend(std::iter::repeat_n(0u8, 4 - rem)); } } diff --git a/src/trx-server/trx-backend/trx-backend-soapysdr/src/dsp.rs b/src/trx-server/trx-backend/trx-backend-soapysdr/src/dsp.rs index cb1653a..91ed2bd 100644 --- a/src/trx-server/trx-backend/trx-backend-soapysdr/src/dsp.rs +++ b/src/trx-server/trx-backend/trx-backend-soapysdr/src/dsp.rs @@ -299,6 +299,7 @@ impl SdrPipeline { pub const IQ_BLOCK_SIZE: usize = 4096; +#[allow(clippy::too_many_arguments)] fn iq_read_loop( mut source: Box, sdr_sample_rate: u32,