From 9b4938504446b90392b6e064ddd5385d54d4ca9e Mon Sep 17 00:00:00 2001 From: mint Date: Wed, 14 Sep 2022 16:14:07 -0300 Subject: [PATCH] inv: list: Code cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit inv::list() had quite an unnecessary function so I cleaned the code a bit so it works a bit more cleanly™ --- src/inv.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/inv.rs b/src/inv.rs index c9ee5ad..42fb0b5 100644 --- a/src/inv.rs +++ b/src/inv.rs @@ -25,14 +25,8 @@ pub fn init() { // Initializes Vento pub fn list(slot: &str) { // Lists files in inventory let ventodir: PathBuf = env_config(); - let active: PathBuf = [ventodir.to_path_buf(), Path::new("active").to_path_buf()].iter().collect(); - let inactive: PathBuf = [ventodir.to_path_buf(), Path::new("inactive").to_path_buf()].iter().collect(); - let slotdir: PathBuf; + let slotdir: PathBuf = [ventodir.to_path_buf(), Path::new(slot).to_path_buf()].iter().collect(); - match slot { // Determines which slot has been selected - "inactive" => slotdir = inactive, - "active" | _ => slotdir = active - }; println!("🗃️ {}", format!("Files in {} inventory:", match slot { "active" => format!("{}", slot).bold(), "inactive" | _ => format!("{}", slot).blue().bold()