From 7fbd8e662e8f66937d647ec1f687dd8f7946de49 Mon Sep 17 00:00:00 2001 From: Rory Dudley Date: Sat, 17 Feb 2024 19:51:17 -0700 Subject: Control flow in cd Make the control flow in our cd implementation a bit easier to read/follow. --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4c7c49a..5f73a15 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,14 +64,14 @@ fn eval(paths: &[&str], prompt: &str) { Some(str) => str, None => env!("HOME"), }; + match std::env::set_current_dir(path) { - Ok(_) => {} + Ok(_) => continue, Err(_) => { println!("cd: Unable to change into {}", path); continue; } } - continue; } // Check if the command exists -- cgit v1.2.3