Where
src/filter.rs:388
// Check connection state
let state_str = format!("{:?}", info.connection_state).to_lowercase();
if match_text(&state_str, fv) {
return true;
}
What
The SSH branch of matches_application_filter derives the matchable connection-state string by Debug-formatting SshConnectionState and lowercasing the result. Two heap allocations per SSH connection per filter criterion per render frame:
format!("{:?}", …) builds a new String via the Debug impl.
.to_lowercase() walks that string and builds another String.
Both allocations are pure waste — SshConnectionState is a fieldless 4-variant enum (Banner, KeyExchange, Authentication, Established) whose lower-case canonical form is known at compile time and can be a &'static str.
Why it matters
Filter evaluation runs over every visible SSH connection on every render tick whenever a non-empty filter query is active. The cost is small per call but cumulative — and conceptually wrong: Debug output is not a stable user-facing string and shouldn't be repurposed as a filter token.
Suggested fix
Replace the format! + to_lowercase with an exhaustive match returning &'static str. The compiler enforces sync with the enum at compile time, so future variants can't silently drift out of filter coverage.
Where
src/filter.rs:388What
The SSH branch of
matches_application_filterderives the matchable connection-state string byDebug-formattingSshConnectionStateand lowercasing the result. Two heap allocations per SSH connection per filter criterion per render frame:format!("{:?}", …)builds a newStringvia theDebugimpl..to_lowercase()walks that string and builds anotherString.Both allocations are pure waste —
SshConnectionStateis a fieldless 4-variant enum (Banner,KeyExchange,Authentication,Established) whose lower-case canonical form is known at compile time and can be a&'static str.Why it matters
Filter evaluation runs over every visible SSH connection on every render tick whenever a non-empty filter query is active. The cost is small per call but cumulative — and conceptually wrong:
Debugoutput is not a stable user-facing string and shouldn't be repurposed as a filter token.Suggested fix
Replace the
format!+to_lowercasewith an exhaustivematchreturning&'static str. The compiler enforces sync with the enum at compile time, so future variants can't silently drift out of filter coverage.