diff --git a/src/command/builtins.rs b/src/command/builtins.rs index 534d1f6..48dc08d 100644 --- a/src/command/builtins.rs +++ b/src/command/builtins.rs @@ -17,7 +17,7 @@ pub(super) fn cd(args: &Vec) -> ExitCode { }; } - let exit_code: ExitCode; + let mut exit_code = ExitCode::success(); if path.is_some() { let path = path.unwrap(); let result = set_current_dir(&path); @@ -26,11 +26,7 @@ pub(super) fn cd(args: &Vec) -> ExitCode { let error = CdError::new(&args[0]); error::print(Box::new(error)); exit_code = ExitCode::new(2); - } else { - exit_code = ExitCode::success(); } - } else { - exit_code = ExitCode::success(); } exit_code