Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Rename enum to avoid stuttering
Browse files Browse the repository at this point in the history
  • Loading branch information
BMeu committed May 17, 2017
1 parent 2521553 commit d186c93
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/execution_flow/exit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use execution_flow::Error;

/// The exit codes returned by the _Mief_.
#[derive(Clone, Copy, Debug)]
pub enum ExitCode {
pub enum Code {
/// Successful (i.e. expected) execution (Code: `0`).
Success = 0,

Expand All @@ -24,18 +24,18 @@ pub enum ExitCode {
pub fn fail_from_error(error: Error) -> ! {
match error {
Error::Piston(message) => {
fail_with_message(ExitCode::PistonFailure, &message);
fail_with_message(Code::PistonFailure, &message);
}
}
}

/// Quit the program execution with the given `exit_code` and an error `message` explaining the exit.
pub fn fail_with_message(exit_code: ExitCode, message: &str) -> ! {
pub fn fail_with_message(exit_code: Code, message: &str) -> ! {
println!("Error: {description}", description = message);
process::exit(exit_code as i32)
}

/// Quit the program execution with a `Success` exit code.
pub fn succeed() -> ! {
process::exit(ExitCode::Success as i32)
process::exit(Code::Success as i32)
}

0 comments on commit d186c93

Please sign in to comment.