refactor(home): drop the labels for two rows the home page stopped offering

`SplitRight` and `SplitDown` were taken out of `HOME_SHORTCUTS` because
both need a pane and the home page is what a window shows without one —
"advertising two chords that do nothing from the only screen that offers
them", as the comment there puts it, with a test to keep them out.

Their labels stayed. `home_shortcut_label` still had an arm for each, and
`HomeSplitRight`/`HomeSplitDown` were carried in three locale tables to
serve those arms and nothing else.

Nothing could point this out. The single caller iterates
`HOME_SHORTCUTS`, so the arms are unreachable — but `_ => action` makes
the match total, so no compiler warning, and the keys are textually
referenced, so `dead_code` sees them as used. Only reading the caller
does it.

Removing the enum variants is what makes this safe rather than hopeful:
the three locale tables match `L10nKey` exhaustively, so the compiler
named every translation to delete and would have caught a fourth.
This commit is contained in:
l0ng-ai
2026-08-16 03:46:50 +08:00
parent b18b3a9179
commit 256bb69f90
5 changed files with 0 additions and 10 deletions
-2
View File
@@ -162,8 +162,6 @@ fn home_shortcut_label(action: &str, closed: Option<&str>) -> String {
"ReopenClosedTab" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeReopenClosedTab),
"ToggleSwitcher" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeSwitchWorkspace),
"TogglePalette" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeCommandPalette),
"SplitRight" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeSplitRight),
"SplitDown" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeSplitDown),
"OpenSettings" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeSettings),
_ => action,
};
-2
View File
@@ -20,8 +20,6 @@ pub fn translate_en(key: L10nKey) -> &'static str {
L10nKey::HomeReopenClosedTab => "Reopen Closed Tab",
L10nKey::HomeSwitchWorkspace => "Switch Workspace…",
L10nKey::HomeCommandPalette => "Command Palette…",
L10nKey::HomeSplitRight => "Split Right",
L10nKey::HomeSplitDown => "Split Down",
L10nKey::HomeSettings => "Settings…",
L10nKey::Reconnect => "Reconnect",
L10nKey::None => "None.",
-2
View File
@@ -20,8 +20,6 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
L10nKey::HomeReopenClosedTab => "閉じたタブをもう一度開く",
L10nKey::HomeSwitchWorkspace => "ワークスペースを切り替える…",
L10nKey::HomeCommandPalette => "コマンドパレット…",
L10nKey::HomeSplitRight => "右に分割",
L10nKey::HomeSplitDown => "下に分割",
L10nKey::HomeSettings => "設定…",
L10nKey::Reconnect => "再接続",
L10nKey::None => "なし",
-2
View File
@@ -98,8 +98,6 @@ l10n_keys! {
HomeReopenClosedTab,
HomeSwitchWorkspace,
HomeCommandPalette,
HomeSplitRight,
HomeSplitDown,
HomeSettings,
Reconnect,
None,
-2
View File
@@ -20,8 +20,6 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
L10nKey::HomeReopenClosedTab => "重新打开已关闭的标签页",
L10nKey::HomeSwitchWorkspace => "切换工作区…",
L10nKey::HomeCommandPalette => "命令面板…",
L10nKey::HomeSplitRight => "向右分屏",
L10nKey::HomeSplitDown => "向下分屏",
L10nKey::HomeSettings => "设置…",
L10nKey::Reconnect => "重新连接",
L10nKey::None => "无。",