From d07946fc416d3231414eade3ccb5e3c25f1082aa Mon Sep 17 00:00:00 2001 From: Liam <33645555+lj3954@users.noreply.github.com> Date: Sat, 10 Aug 2024 20:48:04 -0700 Subject: [PATCH] chore: Slightly improve code structure and commenting --- src/tabs.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tabs.rs b/src/tabs.rs index 6c032746..e46947ce 100644 --- a/src/tabs.rs +++ b/src/tabs.rs @@ -106,8 +106,10 @@ pub fn get_tabs(command_dir: &Path, validate: bool) -> Vec { ), }; for path_index in 1..script_info.ui_path.len() { - let path = script_info.ui_path[..path_index].to_vec(); - if !paths.contains_key(&path) { + let path = &script_info.ui_path[..path_index]; + // Create tabs and directories which don't yet exist + if !paths.contains_key(path) { + let path = path.to_vec(); let tab_name = script_info.ui_path[0].clone(); if path_index == 1 { let tab = Tab { @@ -175,7 +177,7 @@ fn get_script_list(directory: &Path) -> Vec<(PathBuf, PathBuf)> { } else { let is_json = path.extension().map_or(false, |ext| ext == "json"); let script = path.with_extension("sh"); - (is_json).then_some(vec![(path, script)]) + is_json.then_some(vec![(path, script)]) } }) .flatten()