[chore](trx-rs): address clippy warnings

Co-authored-by: Codex <codex@openai.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
2026-02-09 21:26:53 +01:00
parent cf11c16096
commit 5f3ea48ef7
3 changed files with 10 additions and 15 deletions
@@ -483,14 +483,9 @@ async fn wait_for_view(mut rx: watch::Receiver<RigState>) -> Result<RigSnapshot,
// Wait up to 5 seconds for a valid snapshot; fall back to a placeholder // Wait up to 5 seconds for a valid snapshot; fall back to a placeholder
// so the SSE stream starts immediately and the browser isn't left hanging. // so the SSE stream starts immediately and the browser isn't left hanging.
let deadline = time::Instant::now() + Duration::from_secs(5); let deadline = time::Instant::now() + Duration::from_secs(5);
loop { while let Ok(Ok(())) = time::timeout_at(deadline, rx.changed()).await {
match time::timeout_at(deadline, rx.changed()).await { if let Some(view) = rx.borrow().snapshot() {
Ok(Ok(())) => { return Ok(view);
if let Some(view) = rx.borrow().snapshot() {
return Ok(view);
}
}
_ => break,
} }
} }
+3 -3
View File
@@ -186,7 +186,7 @@ fn run_capture(
loop { loop {
let has_receivers = tx.receiver_count() > 0 let has_receivers = tx.receiver_count() > 0
|| pcm_tx.as_ref().map_or(false, |p| p.receiver_count() > 0); || pcm_tx.as_ref().is_some_and(|p| p.receiver_count() > 0);
if has_receivers && !capturing { if has_receivers && !capturing {
let _ = stream.play(); let _ = stream.play();
@@ -592,7 +592,7 @@ fn resample_to_12k(samples: &[f32], sample_rate: u32) -> Option<Vec<f32>> {
if sample_rate == FT8_SAMPLE_RATE { if sample_rate == FT8_SAMPLE_RATE {
return Some(samples.to_vec()); return Some(samples.to_vec());
} }
if sample_rate % FT8_SAMPLE_RATE != 0 { if !sample_rate.is_multiple_of(FT8_SAMPLE_RATE) {
return None; return None;
} }
let factor = (sample_rate / FT8_SAMPLE_RATE) as usize; let factor = (sample_rate / FT8_SAMPLE_RATE) as usize;
@@ -768,7 +768,7 @@ async fn handle_audio_client(
// Send stream info // Send stream info
let info_json = serde_json::to_vec(&stream_info) let info_json = serde_json::to_vec(&stream_info)
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?; .map_err(std::io::Error::other)?;
write_audio_msg(&mut writer, AUDIO_MSG_STREAM_INFO, &info_json).await?; write_audio_msg(&mut writer, AUDIO_MSG_STREAM_INFO, &info_json).await?;
// Send APRS history to newly connected client. // Send APRS history to newly connected client.
+4 -4
View File
@@ -281,12 +281,12 @@ impl Demodulator {
return None; return None;
} }
let mut bytes = vec![0u8; byte_len]; let mut bytes = vec![0u8; byte_len];
for i in 0..byte_len { for (i, out) in bytes.iter_mut().enumerate() {
let mut b: u8 = 0; let mut b: u8 = 0;
for j in 0..8 { for j in 0..8 {
b |= self.frame_bits[i * 8 + j] << j; b |= self.frame_bits[i * 8 + j] << j;
} }
bytes[i] = b; *out = b;
} }
let payload = &bytes[..byte_len - 2]; let payload = &bytes[..byte_len - 2];
@@ -381,7 +381,7 @@ fn parse_aprs(ax25: &Ax25Frame) -> AprsPacket {
let path = ax25 let path = ax25
.digis .digis
.iter() .iter()
.map(|d| format_call(d)) .map(format_call)
.collect::<Vec<_>>() .collect::<Vec<_>>()
.join(","); .join(",");
let info = &ax25.info; let info = &ax25.info;
@@ -481,7 +481,7 @@ fn parse_aprs_compressed(pos: &[u8]) -> Option<(f64, f64, char, char)> {
for i in 0..4 { for i in 0..4 {
let lc = pos[1 + i] as i32 - 33; let lc = pos[1 + i] as i32 - 33;
let xc = pos[5 + i] as i32 - 33; let xc = pos[5 + i] as i32 - 33;
if lc < 0 || lc > 90 || xc < 0 || xc > 90 { if !(0..=90).contains(&lc) || !(0..=90).contains(&xc) {
return None; return None;
} }
lat_val = lat_val * 91 + lc as u32; lat_val = lat_val * 91 + lc as u32;