Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions crates/forktty-ui-gtk/src/socket_cli/hooks/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,11 @@ pub(in crate::socket_cli) fn hook_debug(context: &CliContext, message: &str) {
}

pub(in crate::socket_cli) fn is_truthy_env(key: &str) -> bool {
trimmed_env(key)
.map(|value| matches!(value.to_lowercase().as_str(), "1" | "true" | "yes"))
.unwrap_or(false)
// ⚡ Bolt: Avoid redundant String allocation from `.to_lowercase()` when comparing
// against ASCII literals by using `.eq_ignore_ascii_case()` directly on the borrowed string.
trimmed_env(key).is_some_and(|value| {
value == "1" || value.eq_ignore_ascii_case("true") || value.eq_ignore_ascii_case("yes")
})
}

/// Hook event ordering must survive wall-clock steps (NTP, manual `date`):
Expand Down
Loading