[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:
@@ -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
|
||||
// so the SSE stream starts immediately and the browser isn't left hanging.
|
||||
let deadline = time::Instant::now() + Duration::from_secs(5);
|
||||
loop {
|
||||
match time::timeout_at(deadline, rx.changed()).await {
|
||||
Ok(Ok(())) => {
|
||||
if let Some(view) = rx.borrow().snapshot() {
|
||||
return Ok(view);
|
||||
}
|
||||
}
|
||||
_ => break,
|
||||
while let Ok(Ok(())) = time::timeout_at(deadline, rx.changed()).await {
|
||||
if let Some(view) = rx.borrow().snapshot() {
|
||||
return Ok(view);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ fn run_capture(
|
||||
|
||||
loop {
|
||||
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 {
|
||||
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 {
|
||||
return Some(samples.to_vec());
|
||||
}
|
||||
if sample_rate % FT8_SAMPLE_RATE != 0 {
|
||||
if !sample_rate.is_multiple_of(FT8_SAMPLE_RATE) {
|
||||
return None;
|
||||
}
|
||||
let factor = (sample_rate / FT8_SAMPLE_RATE) as usize;
|
||||
@@ -768,7 +768,7 @@ async fn handle_audio_client(
|
||||
|
||||
// Send 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?;
|
||||
|
||||
// Send APRS history to newly connected client.
|
||||
|
||||
@@ -281,12 +281,12 @@ impl Demodulator {
|
||||
return None;
|
||||
}
|
||||
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;
|
||||
for j in 0..8 {
|
||||
b |= self.frame_bits[i * 8 + j] << j;
|
||||
}
|
||||
bytes[i] = b;
|
||||
*out = b;
|
||||
}
|
||||
|
||||
let payload = &bytes[..byte_len - 2];
|
||||
@@ -381,7 +381,7 @@ fn parse_aprs(ax25: &Ax25Frame) -> AprsPacket {
|
||||
let path = ax25
|
||||
.digis
|
||||
.iter()
|
||||
.map(|d| format_call(d))
|
||||
.map(format_call)
|
||||
.collect::<Vec<_>>()
|
||||
.join(",");
|
||||
let info = &ax25.info;
|
||||
@@ -481,7 +481,7 @@ fn parse_aprs_compressed(pos: &[u8]) -> Option<(f64, f64, char, char)> {
|
||||
for i in 0..4 {
|
||||
let lc = pos[1 + 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;
|
||||
}
|
||||
lat_val = lat_val * 91 + lc as u32;
|
||||
|
||||
Reference in New Issue
Block a user