From a2838b06a2da009133f053e4a88699a5f0bb6374 Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Sat, 18 Jul 2026 09:25:12 +0200 Subject: [PATCH] [style](trx-ftx): fix clippy question_mark and collapsible_match CI runs a newer clippy (1.97) than was available locally, which flagged three lints in trx-ftx not caught earlier: - question_mark: replace the Some/None match in CallsignHashTable::lookup with `self.entries[idx].as_ref()?` - collapsible_match: fold the nested `if` in text.rs char/nchar into match guards on the AlphanumSpaceSlash arm Behaviour is unchanged; verified clean with nightly clippy (1.93). Assisted-By: Claude Code (claude-opus-4) Claude-Session: https://claude.ai/code/session_01NFpGtGTWUEYXLwZeZs2RAV Signed-off-by: Stan Grams --- .../trx-ftx/src/common/callsign_hash.rs | 20 ++++++++----------- src/decoders/trx-ftx/src/common/text.rs | 12 ++++------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/decoders/trx-ftx/src/common/callsign_hash.rs b/src/decoders/trx-ftx/src/common/callsign_hash.rs index c743f4aa..576df83d 100644 --- a/src/decoders/trx-ftx/src/common/callsign_hash.rs +++ b/src/decoders/trx-ftx/src/common/callsign_hash.rs @@ -160,18 +160,14 @@ impl CallsignHashTable { let mut idx = start_idx; loop { - match &self.entries[idx] { - Some(entry) => { - let stored = (entry.hash & HASH22_MASK) >> shift; - if stored == target { - return Some(entry.callsign.clone()); - } - idx = (idx + 1) % CALLSIGN_HASHTABLE_SIZE; - if idx == start_idx { - return None; - } - } - None => return None, + let entry = self.entries[idx].as_ref()?; + let stored = (entry.hash & HASH22_MASK) >> shift; + if stored == target { + return Some(entry.callsign.clone()); + } + idx = (idx + 1) % CALLSIGN_HASHTABLE_SIZE; + if idx == start_idx { + return None; } } } diff --git a/src/decoders/trx-ftx/src/common/text.rs b/src/decoders/trx-ftx/src/common/text.rs index 6230a2dc..772a230f 100644 --- a/src/decoders/trx-ftx/src/common/text.rs +++ b/src/decoders/trx-ftx/src/common/text.rs @@ -64,10 +64,8 @@ pub fn charn(mut c: i32, table: CharTable) -> char { return EXTRAS[c as usize]; } } - CharTable::AlphanumSpaceSlash => { - if c == 0 { - return '/'; - } + CharTable::AlphanumSpaceSlash if c == 0 => { + return '/'; } _ => {} } @@ -116,10 +114,8 @@ pub fn nchar(c: char, table: CharTable) -> Option { '?' => return Some(n + 4), _ => {} }, - CharTable::AlphanumSpaceSlash => { - if c == '/' { - return Some(n); - } + CharTable::AlphanumSpaceSlash if c == '/' => { + return Some(n); } _ => {} }