[fix](trx-rs): resolve all clippy warnings

- 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 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
2026-03-17 00:15:03 +01:00
parent 6eb2d5341f
commit 016d4ddfd7
4 changed files with 7 additions and 2 deletions
+3
View File
@@ -666,6 +666,7 @@ fn parse_port(port_str: &str) -> Result<u16, String> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::{parse_remote_url, RemoteClientConfig, RemoteEndpoint, SharedSpectrum}; use super::{parse_remote_url, RemoteClientConfig, RemoteEndpoint, SharedSpectrum};
use std::sync::atomic::AtomicBool;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::time::Duration; use std::time::Duration;
@@ -849,6 +850,7 @@ mod tests {
known_rigs: Arc::new(Mutex::new(Vec::new())), known_rigs: Arc::new(Mutex::new(Vec::new())),
poll_interval: Duration::from_millis(100), poll_interval: Duration::from_millis(100),
spectrum: Arc::new(spectrum_tx), spectrum: Arc::new(spectrum_tx),
server_connected: Arc::new(AtomicBool::new(false)),
}, },
req_rx, req_rx,
state_tx, state_tx,
@@ -886,6 +888,7 @@ mod tests {
known_rigs: Arc::new(Mutex::new(Vec::new())), known_rigs: Arc::new(Mutex::new(Vec::new())),
poll_interval: Duration::from_millis(500), poll_interval: Duration::from_millis(500),
spectrum: Arc::new(spectrum_tx), spectrum: Arc::new(spectrum_tx),
server_connected: Arc::new(AtomicBool::new(false)),
}; };
let envelope = super::build_envelope(&config, trx_protocol::ClientCommand::GetState, None); let envelope = super::build_envelope(&config, trx_protocol::ClientCommand::GetState, None);
assert_eq!(envelope.token.as_deref(), Some("secret")); assert_eq!(envelope.token.as_deref(), Some("secret"));
@@ -411,6 +411,7 @@ pub struct SchedulerStatus {
pub last_bookmark_ids: Vec<String>, pub last_bookmark_ids: Vec<String>,
} }
#[allow(clippy::too_many_arguments)]
async fn apply_scheduler_target( async fn apply_scheduler_target(
rig_tx: &mpsc::Sender<RigRequest>, rig_tx: &mpsc::Sender<RigRequest>,
rig_id: &str, rig_id: &str,
+2 -2
View File
@@ -420,7 +420,7 @@ impl PskReporterClient {
let include_templates = self.packets_sent < 3 let include_templates = self.packets_sent < 3
|| self || self
.last_template_instant .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)?; let packet = self.make_packet(spots, include_templates)?;
self.socket self.socket
@@ -501,7 +501,7 @@ impl PskReporterClient {
fn pad_to_4(buf: &mut Vec<u8>) { fn pad_to_4(buf: &mut Vec<u8>) {
let rem = buf.len() % 4; let rem = buf.len() % 4;
if rem != 0 { if rem != 0 {
buf.extend(std::iter::repeat(0u8).take(4 - rem)); buf.extend(std::iter::repeat_n(0u8, 4 - rem));
} }
} }
@@ -299,6 +299,7 @@ impl SdrPipeline {
pub const IQ_BLOCK_SIZE: usize = 4096; pub const IQ_BLOCK_SIZE: usize = 4096;
#[allow(clippy::too_many_arguments)]
fn iq_read_loop( fn iq_read_loop(
mut source: Box<dyn IqSource>, mut source: Box<dyn IqSource>,
sdr_sample_rate: u32, sdr_sample_rate: u32,