[style](trx-ftx): fix clippy question_mark and collapsible_match
CI / lint (pull_request) Failing after 2m22s
CI / test (pull_request) Successful in 3m27s
CI / reuse (pull_request) Successful in 8s

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 <sjg@haxx.space>
This commit is contained in:
sjg
2026-07-18 09:25:12 +02:00
parent c6cd661676
commit a2838b06a2
2 changed files with 12 additions and 20 deletions
@@ -160,18 +160,14 @@ impl CallsignHashTable {
let mut idx = start_idx; let mut idx = start_idx;
loop { loop {
match &self.entries[idx] { let entry = self.entries[idx].as_ref()?;
Some(entry) => { let stored = (entry.hash & HASH22_MASK) >> shift;
let stored = (entry.hash & HASH22_MASK) >> shift; if stored == target {
if stored == target { return Some(entry.callsign.clone());
return Some(entry.callsign.clone()); }
} idx = (idx + 1) % CALLSIGN_HASHTABLE_SIZE;
idx = (idx + 1) % CALLSIGN_HASHTABLE_SIZE; if idx == start_idx {
if idx == start_idx { return None;
return None;
}
}
None => return None,
} }
} }
} }
+4 -8
View File
@@ -64,10 +64,8 @@ pub fn charn(mut c: i32, table: CharTable) -> char {
return EXTRAS[c as usize]; return EXTRAS[c as usize];
} }
} }
CharTable::AlphanumSpaceSlash => { CharTable::AlphanumSpaceSlash if c == 0 => {
if c == 0 { return '/';
return '/';
}
} }
_ => {} _ => {}
} }
@@ -116,10 +114,8 @@ pub fn nchar(c: char, table: CharTable) -> Option<i32> {
'?' => return Some(n + 4), '?' => return Some(n + 4),
_ => {} _ => {}
}, },
CharTable::AlphanumSpaceSlash => { CharTable::AlphanumSpaceSlash if c == '/' => {
if c == '/' { return Some(n);
return Some(n);
}
} }
_ => {} _ => {}
} }