From d0ff354c49cc1c4cfa52e8c9663894529bacd295 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Thu, 19 Sep 2024 20:29:08 +0200 Subject: [PATCH] Collapsed if statements (#534) --- tui/src/hint.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tui/src/hint.rs b/tui/src/hint.rs index 034406db..cfdce25f 100644 --- a/tui/src/hint.rs +++ b/tui/src/hint.rs @@ -125,17 +125,15 @@ pub fn draw_shortcuts(state: &AppState, frame: &mut Frame, area: Rect) { if state.at_root() { hints.push(Shortcut::new(vec!["h", "Left"], "Focus tab list")); hints.extend(get_list_item_shortcut(state)); + } else if state.selected_item_is_up_dir() { + hints.push(Shortcut::new( + vec!["l", "Right", "Enter", "h", "Left"], + "Go to parent directory", + )); } else { - if state.selected_item_is_up_dir() { - hints.push(Shortcut::new( - vec!["l", "Right", "Enter", "h", "Left"], - "Go to parent directory", - )); - } else { - hints.push(Shortcut::new(vec!["h", "Left"], "Go to parent directory")); - hints.extend(get_list_item_shortcut(state)); - } - }; + hints.push(Shortcut::new(vec!["h", "Left"], "Go to parent directory")); + hints.extend(get_list_item_shortcut(state)); + } hints.push(Shortcut::new(vec!["k", "Up"], "Select item above")); hints.push(Shortcut::new(vec!["j", "Down"], "Select item below")); hints.push(Shortcut::new(vec!["t"], "Next theme"));