From 083caf412fdfc626b67890f99b69db79a13613ee Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Sun, 29 Mar 2026 22:59:43 +0200 Subject: [PATCH] [style](trx-rs): apply rustfmt formatting Co-Authored-By: Claude Opus 4.6 Signed-off-by: Stan Grams --- src/decoders/trx-vdes/src/lib.rs | 8 +- src/decoders/trx-vdes/src/link_layer.rs | 2 +- src/decoders/trx-vdes/src/turbo.rs | 37 +++--- src/trx-client/src/remote_client.rs | 3 +- .../trx-frontend-http/src/api/assets.rs | 7 +- .../trx-frontend-http/src/api/bookmarks.rs | 2 +- .../trx-frontend-http/src/api/decoder.rs | 4 +- .../trx-frontend-http/src/api/mod.rs | 4 +- .../trx-frontend-http/src/api/sse.rs | 8 +- .../trx-frontend-http/src/api/vchan.rs | 2 +- .../src/background_decode.rs | 122 ++++++++++++++---- src/trx-server/src/audio.rs | 16 ++- src/trx-server/src/listener.rs | 72 ++++------- 13 files changed, 165 insertions(+), 122 deletions(-) diff --git a/src/decoders/trx-vdes/src/lib.rs b/src/decoders/trx-vdes/src/lib.rs index c05d4bb..806680f 100644 --- a/src/decoders/trx-vdes/src/lib.rs +++ b/src/decoders/trx-vdes/src/lib.rs @@ -248,13 +248,7 @@ impl VdesDecoder { if let Some(ref ll_frame) = viterbi_frame { if ll_frame.crc_ok { return Some(build_link_layer_message( - channel, - ll_frame, - &framed, - &mode, - rms, - link_id, - 0.0, + channel, ll_frame, &framed, &mode, rms, link_id, 0.0, )); } } diff --git a/src/decoders/trx-vdes/src/link_layer.rs b/src/decoders/trx-vdes/src/link_layer.rs index 5c2e17a..628893d 100644 --- a/src/decoders/trx-vdes/src/link_layer.rs +++ b/src/decoders/trx-vdes/src/link_layer.rs @@ -345,7 +345,7 @@ mod tests { write_bits(&mut bits, 6, 6, 5); // session_id = 5 write_bits(&mut bits, 12, 32, 123456); // source_id write_bits(&mut bits, 44, 11, 20); // data_count = 20 - // Fill some payload + // Fill some payload for i in 55..75 { bits[i] = (i % 2) as u8; } diff --git a/src/decoders/trx-vdes/src/turbo.rs b/src/decoders/trx-vdes/src/turbo.rs index bfbf4aa..97e9f82 100644 --- a/src/decoders/trx-vdes/src/turbo.rs +++ b/src/decoders/trx-vdes/src/turbo.rs @@ -101,8 +101,8 @@ fn find_qpp_params(block_size: usize) -> (usize, usize) { fn is_valid_qpp(block_size: usize, f1: usize, f2: usize) -> bool { let mut seen = vec![false; block_size]; for i in 0..block_size { - let idx = ((f1 as u64 * i as u64 + f2 as u64 * (i as u64 * i as u64)) - % block_size as u64) as usize; + let idx = ((f1 as u64 * i as u64 + f2 as u64 * (i as u64 * i as u64)) % block_size as u64) + as usize; if seen[idx] { return false; } @@ -143,7 +143,10 @@ fn gcd(mut a: usize, mut b: usize) -> usize { /// /// Input: received LLRs (positive = likely 0, negative = likely 1) /// Output: (systematic, parity1, parity2) LLR vectors -pub fn depuncture_rate_half(received_llrs: &[Llr], info_len: usize) -> (Vec, Vec, Vec) { +pub fn depuncture_rate_half( + received_llrs: &[Llr], + info_len: usize, +) -> (Vec, Vec, Vec) { let mut systematic = vec![0.0; info_len]; let mut parity1 = vec![0.0; info_len]; let mut parity2 = vec![0.0; info_len]; @@ -231,10 +234,7 @@ pub fn turbo_decode_soft(received_llrs: &[Llr], info_len: usize) -> (Vec, f3 for _iter in 0..TURBO_ITERATIONS { // --- Decoder 1 (natural order) --- - let apriori_1: Vec = deinterleaver - .iter() - .map(|&i| extrinsic_2_to_1[i]) - .collect(); + let apriori_1: Vec = deinterleaver.iter().map(|&i| extrinsic_2_to_1[i]).collect(); let aposteriori_1 = bcjr_decode(&sys_llr, &par1_llr, &apriori_1); // Extrinsic = aposteriori - systematic - apriori for k in 0..info_len { @@ -242,10 +242,7 @@ pub fn turbo_decode_soft(received_llrs: &[Llr], info_len: usize) -> (Vec, f3 } // --- Decoder 2 (interleaved order) --- - let apriori_2: Vec = interleaver - .iter() - .map(|&i| extrinsic_1_to_2[i]) - .collect(); + let apriori_2: Vec = interleaver.iter().map(|&i| extrinsic_1_to_2[i]).collect(); let aposteriori_2 = bcjr_decode(&sys_interleaved, &par2_llr, &apriori_2); for k in 0..info_len { extrinsic_2_to_1[k] = aposteriori_2[k] - sys_interleaved[k] - apriori_2[k]; @@ -254,11 +251,11 @@ pub fn turbo_decode_soft(received_llrs: &[Llr], info_len: usize) -> (Vec, f3 // Combine for final decision (deinterleave decoder 2 output) for k in 0..info_len { let deint_apost2 = aposteriori_2[deinterleaver[k]]; - final_llr[k] = sys_llr[k] + extrinsic_1_to_2[k] + deint_apost2 - - sys_llr[k] - - extrinsic_1_to_2[k]; + final_llr[k] = + sys_llr[k] + extrinsic_1_to_2[k] + deint_apost2 - sys_llr[k] - extrinsic_1_to_2[k]; // Simplified: final = systematic + extrinsic from both decoders - final_llr[k] = sys_llr[k] + apriori_1[k] + (aposteriori_1[k] - sys_llr[k] - apriori_1[k]); + final_llr[k] = + sys_llr[k] + apriori_1[k] + (aposteriori_1[k] - sys_llr[k] - apriori_1[k]); } } @@ -348,7 +345,8 @@ fn bcjr_decode(systematic: &[Llr], parity: &[Llr], apriori: &[Llr]) -> Vec -par_ext[t] / 2.0 }; let branch = sys_metric + par_metric; - alpha[t + 1][next_state] = log_sum_exp(alpha[t + 1][next_state], alpha[t][s] + branch); + alpha[t + 1][next_state] = + log_sum_exp(alpha[t + 1][next_state], alpha[t][s] + branch); } } } @@ -543,7 +541,12 @@ mod tests { let b = 3.0f32; let expected = (a.exp() + b.exp()).ln(); let result = log_sum_exp(a, b); - assert!((result - expected).abs() < 0.01, "got {}, expected {}", result, expected); + assert!( + (result - expected).abs() < 0.01, + "got {}, expected {}", + result, + expected + ); } #[test] diff --git a/src/trx-client/src/remote_client.rs b/src/trx-client/src/remote_client.rs index 4deecb2..23a9b3d 100644 --- a/src/trx-client/src/remote_client.rs +++ b/src/trx-client/src/remote_client.rs @@ -524,8 +524,7 @@ async fn send_command( // Update the per-rig watch channel first so SSE sessions // subscribed to a specific rig see the change immediately // instead of waiting for the next poll cycle. - let channel_key = channel_key_override - .or_else(|| selected_rig_id(config)); + let channel_key = channel_key_override.or_else(|| selected_rig_id(config)); if let Some(key) = channel_key { if let Ok(map) = config.rig_states.read() { if let Some(tx) = map.get(&key) { diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/api/assets.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/api/assets.rs index a55049a..5ac8a53 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/api/assets.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/api/assets.rs @@ -4,15 +4,12 @@ //! Static asset serving endpoints (HTML pages, JS, CSS, favicon, logo). -use actix_web::{get, HttpRequest, HttpResponse, Responder}; use actix_web::http::header; +use actix_web::{get, HttpRequest, HttpResponse, Responder}; use std::sync::OnceLock; +use super::{gz_cache_entry, static_asset_response, GzCacheEntry, FAVICON_BYTES, LOGO_BYTES}; use crate::server::status; -use super::{ - static_asset_response, GzCacheEntry, gz_cache_entry, - FAVICON_BYTES, LOGO_BYTES, -}; // --------------------------------------------------------------------------- // Pre-compressed asset caches diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/api/bookmarks.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/api/bookmarks.rs index ad2c2f4..e0a6851 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/api/bookmarks.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/api/bookmarks.rs @@ -6,8 +6,8 @@ use std::sync::Arc; -use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse}; use actix_web::Error; +use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse}; use super::{no_cache_response, request_accepts_html, require_control}; use crate::server::status; diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/api/decoder.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/api/decoder.rs index f417097..73dfec4 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/api/decoder.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/api/decoder.rs @@ -6,9 +6,9 @@ use std::sync::Arc; -use actix_web::{get, post, web, HttpResponse, Responder}; -use actix_web::Error; use actix_web::http::header; +use actix_web::Error; +use actix_web::{get, post, web, HttpResponse, Responder}; use bytes::Bytes; use futures_util::stream::{select, StreamExt}; use tokio::sync::{broadcast, mpsc, watch}; diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/api/mod.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/api/mod.rs index f991733..f063c4e 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/api/mod.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/api/mod.rs @@ -902,7 +902,9 @@ mod tests { ) .await; - let req = actix_test::TestRequest::post().uri("/set_freq").to_request(); + let req = actix_test::TestRequest::post() + .uri("/set_freq") + .to_request(); let resp = actix_test::call_service(&app, req).await; assert_eq!(resp.status(), 400); } diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/api/sse.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/api/sse.rs index ea59c29..6eb0358 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/api/sse.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/api/sse.rs @@ -7,9 +7,9 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; -use actix_web::{get, web, HttpResponse}; -use actix_web::Error; use actix_web::http::header; +use actix_web::Error; +use actix_web::{get, web, HttpResponse}; use bytes::Bytes; use futures_util::stream::{select, StreamExt}; use tokio::sync::{broadcast, watch}; @@ -23,8 +23,8 @@ use trx_frontend::FrontendRuntimeContext; use crate::server::vchan::ClientChannelManager; use super::{ - base64_encode, frontend_meta_from_context, wait_for_view, - RemoteQuery, SessionRigManager, SnapshotWithMeta, + base64_encode, frontend_meta_from_context, wait_for_view, RemoteQuery, SessionRigManager, + SnapshotWithMeta, }; // ============================================================================ diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/api/vchan.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/api/vchan.rs index 2185c34..5be5e1e 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/api/vchan.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/api/vchan.rs @@ -6,8 +6,8 @@ use std::sync::Arc; -use actix_web::{delete, get, post, put, web, HttpResponse, Responder}; use actix_web::Error; +use actix_web::{delete, get, post, put, web, HttpResponse, Responder}; use tokio::sync::mpsc; use uuid::Uuid; diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/background_decode.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/background_decode.rs index 8cf3e21..ea675ae 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/background_decode.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/background_decode.rs @@ -563,9 +563,7 @@ fn evaluate_bookmark( }; } if !enabled { - return ChannelAction::Skip { - reason: "disabled", - }; + return ChannelAction::Skip { reason: "disabled" }; } if !users_connected { return ChannelAction::Skip { @@ -702,15 +700,15 @@ mod tests { #[test] fn active_when_all_conditions_met() { let action = evaluate_bookmark( - false, // decoder_kinds_empty - true, // enabled - true, // users_connected - false, // scheduler_has_control + false, // decoder_kinds_empty + true, // enabled + true, // users_connected + false, // scheduler_has_control &empty_scheduled(), "bm1", - false, // vchan_covers_bookmark + false, // vchan_covers_bookmark Some((14_074_000, 96_000)), // spectrum_span (center, half) - 14_074_000, // freq_hz + 14_074_000, // freq_hz ); assert_eq!(action, ChannelAction::Active); } @@ -718,8 +716,15 @@ mod tests { #[test] fn skip_no_supported_decoders() { let action = evaluate_bookmark( - true, true, true, false, &empty_scheduled(), "bm1", false, - Some((14_074_000, 96_000)), 14_074_000, + true, + true, + true, + false, + &empty_scheduled(), + "bm1", + false, + Some((14_074_000, 96_000)), + 14_074_000, ); assert_eq!( action, @@ -732,8 +737,15 @@ mod tests { #[test] fn skip_disabled() { let action = evaluate_bookmark( - false, false, true, false, &empty_scheduled(), "bm1", false, - Some((14_074_000, 96_000)), 14_074_000, + false, + false, + true, + false, + &empty_scheduled(), + "bm1", + false, + Some((14_074_000, 96_000)), + 14_074_000, ); assert_eq!(action, ChannelAction::Skip { reason: "disabled" }); } @@ -741,8 +753,15 @@ mod tests { #[test] fn skip_waiting_for_user() { let action = evaluate_bookmark( - false, true, false, false, &empty_scheduled(), "bm1", false, - Some((14_074_000, 96_000)), 14_074_000, + false, + true, + false, + false, + &empty_scheduled(), + "bm1", + false, + Some((14_074_000, 96_000)), + 14_074_000, ); assert_eq!( action, @@ -755,8 +774,15 @@ mod tests { #[test] fn skip_scheduler_has_control() { let action = evaluate_bookmark( - false, true, true, true, &empty_scheduled(), "bm1", false, - Some((14_074_000, 96_000)), 14_074_000, + false, + true, + true, + true, + &empty_scheduled(), + "bm1", + false, + Some((14_074_000, 96_000)), + 14_074_000, ); assert_eq!( action, @@ -771,8 +797,15 @@ mod tests { let mut scheduled = HashSet::new(); scheduled.insert("bm1".to_string()); let action = evaluate_bookmark( - false, true, true, false, &scheduled, "bm1", false, - Some((14_074_000, 96_000)), 14_074_000, + false, + true, + true, + false, + &scheduled, + "bm1", + false, + Some((14_074_000, 96_000)), + 14_074_000, ); assert_eq!( action, @@ -785,8 +818,15 @@ mod tests { #[test] fn skip_handled_by_virtual_channel() { let action = evaluate_bookmark( - false, true, true, false, &empty_scheduled(), "bm1", true, - Some((14_074_000, 96_000)), 14_074_000, + false, + true, + true, + false, + &empty_scheduled(), + "bm1", + true, + Some((14_074_000, 96_000)), + 14_074_000, ); assert_eq!( action, @@ -799,8 +839,15 @@ mod tests { #[test] fn skip_waiting_for_spectrum() { let action = evaluate_bookmark( - false, true, true, false, &empty_scheduled(), "bm1", false, - None, 14_074_000, + false, + true, + true, + false, + &empty_scheduled(), + "bm1", + false, + None, + 14_074_000, ); assert_eq!( action, @@ -813,9 +860,15 @@ mod tests { #[test] fn skip_out_of_span() { let action = evaluate_bookmark( - false, true, true, false, &empty_scheduled(), "bm1", false, + false, + true, + true, + false, + &empty_scheduled(), + "bm1", + false, Some((14_074_000, 96_000)), // center 14.074 MHz, half span 96 kHz - 7_074_000, // way outside the span + 7_074_000, // way outside the span ); assert_eq!( action, @@ -828,7 +881,13 @@ mod tests { #[test] fn active_at_edge_of_span() { let action = evaluate_bookmark( - false, true, true, false, &empty_scheduled(), "bm1", false, + false, + true, + true, + false, + &empty_scheduled(), + "bm1", + false, Some((14_074_000, 96_000)), 14_074_000 + 96_000, // exactly at the edge ); @@ -839,8 +898,15 @@ mod tests { fn priority_no_decoders_over_disabled() { // Even if disabled, "no_supported_decoders" should take precedence let action = evaluate_bookmark( - true, false, true, false, &empty_scheduled(), "bm1", false, - Some((14_074_000, 96_000)), 14_074_000, + true, + false, + true, + false, + &empty_scheduled(), + "bm1", + false, + Some((14_074_000, 96_000)), + 14_074_000, ); assert_eq!( action, diff --git a/src/trx-server/src/audio.rs b/src/trx-server/src/audio.rs index 4e3c79f..a852fb2 100644 --- a/src/trx-server/src/audio.rs +++ b/src/trx-server/src/audio.rs @@ -1242,7 +1242,10 @@ async fn run_aprs_decoder_inner( histories: Arc, is_hf: bool, ) { - info!("{} decoder started ({}Hz, {} ch)", label, sample_rate, channels); + info!( + "{} decoder started ({}Hz, {} ch)", + label, sample_rate, channels + ); let mut decoder = if is_hf { AprsDecoder::new_hf(sample_rate) @@ -1266,7 +1269,11 @@ async fn run_aprs_decoder_inner( state.reset_seqs.aprs_decode_reset_seq } }; - let span_name = if is_hf { "hf_aprs_decode" } else { "aprs_decode" }; + let span_name = if is_hf { + "hf_aprs_decode" + } else { + "aprs_decode" + }; let mut active = mode_match(&state_rx.borrow()); @@ -1849,7 +1856,10 @@ async fn run_ftx_decoder_inner( histories: Arc, is_ft4: bool, ) { - info!("{} decoder started ({}Hz, {} ch)", label, sample_rate, channels); + info!( + "{} decoder started ({}Hz, {} ch)", + label, sample_rate, channels + ); let mut decoder = { let result = if is_ft4 { diff --git a/src/trx-server/src/listener.rs b/src/trx-server/src/listener.rs index 97f5e5d..8dd08df 100644 --- a/src/trx-server/src/listener.rs +++ b/src/trx-server/src/listener.rs @@ -911,10 +911,8 @@ mod tests { #[ignore = "requires TCP bind permissions"] async fn multi_rig_state_isolation() { // Two rigs with different frequencies and modes. - let state_hf = - sample_state_custom("HF-Dummy", 14_200_000, trx_core::RigMode::USB); - let state_vhf = - sample_state_custom("VHF-Dummy", 145_500_000, trx_core::RigMode::FM); + let state_hf = sample_state_custom("HF-Dummy", 14_200_000, trx_core::RigMode::USB); + let state_vhf = sample_state_custom("VHF-Dummy", 145_500_000, trx_core::RigMode::FM); let (rigs, default_id, _rx_a, _rx_b) = make_two_rigs(state_hf, state_vhf); let addr = loopback_addr(); @@ -978,10 +976,8 @@ mod tests { #[ignore = "requires TCP bind permissions"] async fn multi_rig_default_fallback() { // When rig_id is omitted, the default rig (rig_hf) should be used. - let state_hf = - sample_state_custom("HF-Dummy", 14_200_000, trx_core::RigMode::USB); - let state_vhf = - sample_state_custom("VHF-Dummy", 145_500_000, trx_core::RigMode::FM); + let state_hf = sample_state_custom("HF-Dummy", 14_200_000, trx_core::RigMode::USB); + let state_vhf = sample_state_custom("VHF-Dummy", 145_500_000, trx_core::RigMode::FM); let (rigs, default_id, _rx_a, _rx_b) = make_two_rigs(state_hf, state_vhf); let addr = loopback_addr(); @@ -1004,12 +1000,7 @@ mod tests { let mut reader = BufReader::new(read_half); // No rig_id — should resolve to default (rig_hf). - let resp = send_and_recv( - &mut writer, - &mut reader, - br#"{"cmd":"get_state"}"#, - ) - .await; + let resp = send_and_recv(&mut writer, &mut reader, br#"{"cmd":"get_state"}"#).await; assert!(resp.success, "default get_state should succeed"); assert_eq!(resp.rig_id.as_deref(), Some("rig_hf")); let snap = resp.state.expect("default snapshot"); @@ -1023,10 +1014,8 @@ mod tests { #[tokio::test] #[ignore = "requires TCP bind permissions"] async fn multi_rig_get_rigs_returns_all() { - let state_hf = - sample_state_custom("HF-Dummy", 14_200_000, trx_core::RigMode::USB); - let state_vhf = - sample_state_custom("VHF-Dummy", 145_500_000, trx_core::RigMode::FM); + let state_hf = sample_state_custom("HF-Dummy", 14_200_000, trx_core::RigMode::USB); + let state_vhf = sample_state_custom("VHF-Dummy", 145_500_000, trx_core::RigMode::FM); let (rigs, default_id, _rx_a, _rx_b) = make_two_rigs(state_hf, state_vhf); let addr = loopback_addr(); @@ -1048,12 +1037,7 @@ mod tests { let (read_half, mut writer) = stream.into_split(); let mut reader = BufReader::new(read_half); - let resp = send_and_recv( - &mut writer, - &mut reader, - br#"{"cmd":"get_rigs"}"#, - ) - .await; + let resp = send_and_recv(&mut writer, &mut reader, br#"{"cmd":"get_rigs"}"#).await; assert!(resp.success, "get_rigs should succeed"); let entries = resp.rigs.expect("rigs list"); assert_eq!(entries.len(), 2, "should return both rigs"); @@ -1090,13 +1074,10 @@ mod tests { async fn multi_rig_command_routing() { // Verify that a set_freq command targeting rig_vhf is delivered to the // VHF rig's mpsc channel and not to the HF rig's channel. - let state_hf = - sample_state_custom("HF-Dummy", 14_200_000, trx_core::RigMode::USB); - let state_vhf = - sample_state_custom("VHF-Dummy", 145_500_000, trx_core::RigMode::FM); + let state_hf = sample_state_custom("HF-Dummy", 14_200_000, trx_core::RigMode::USB); + let state_vhf = sample_state_custom("VHF-Dummy", 145_500_000, trx_core::RigMode::FM); - let (rigs, default_id, mut rx_hf, mut rx_vhf) = - make_two_rigs(state_hf, state_vhf); + let (rigs, default_id, mut rx_hf, mut rx_vhf) = make_two_rigs(state_hf, state_vhf); let addr = loopback_addr(); let (shutdown_tx, shutdown_rx) = watch::channel(false); @@ -1125,13 +1106,10 @@ mod tests { writer.flush().await.expect("flush"); // The VHF channel should receive the command. - let req = tokio::time::timeout( - std::time::Duration::from_secs(2), - rx_vhf.recv(), - ) - .await - .expect("timeout waiting for VHF command") - .expect("VHF channel closed"); + let req = tokio::time::timeout(std::time::Duration::from_secs(2), rx_vhf.recv()) + .await + .expect("timeout waiting for VHF command") + .expect("VHF channel closed"); assert!( matches!(req.cmd, trx_core::rig::command::RigCommand::SetFreq(f) if f.hz == 146_000_000), "VHF rig should receive SetFreq(146 MHz), got {:?}", @@ -1153,13 +1131,10 @@ mod tests { #[ignore = "requires TCP bind permissions"] async fn multi_rig_command_routing_to_default() { // When rig_id is omitted, commands should go to the default rig (HF). - let state_hf = - sample_state_custom("HF-Dummy", 14_200_000, trx_core::RigMode::USB); - let state_vhf = - sample_state_custom("VHF-Dummy", 145_500_000, trx_core::RigMode::FM); + let state_hf = sample_state_custom("HF-Dummy", 14_200_000, trx_core::RigMode::USB); + let state_vhf = sample_state_custom("VHF-Dummy", 145_500_000, trx_core::RigMode::FM); - let (rigs, default_id, mut rx_hf, mut rx_vhf) = - make_two_rigs(state_hf, state_vhf); + let (rigs, default_id, mut rx_hf, mut rx_vhf) = make_two_rigs(state_hf, state_vhf); let addr = loopback_addr(); let (shutdown_tx, shutdown_rx) = watch::channel(false); @@ -1187,13 +1162,10 @@ mod tests { writer.flush().await.expect("flush"); // The HF channel should receive the command. - let req = tokio::time::timeout( - std::time::Duration::from_secs(2), - rx_hf.recv(), - ) - .await - .expect("timeout waiting for HF command") - .expect("HF channel closed"); + let req = tokio::time::timeout(std::time::Duration::from_secs(2), rx_hf.recv()) + .await + .expect("timeout waiting for HF command") + .expect("HF channel closed"); assert!( matches!(req.cmd, trx_core::rig::command::RigCommand::SetFreq(f) if f.hz == 7_100_000), "HF rig should receive SetFreq(7.1 MHz), got {:?}",