From c75b262231a2c6a5652810264d6518808347265b Mon Sep 17 00:00:00 2001 From: PfaulJulian Date: Sat, 18 May 2024 12:17:25 +0200 Subject: [PATCH 1/2] Changed return tyoe of fn main() in src/main.rs to fn main() -> std::process::ExitCode. --- src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index ea90ce51..2e9cf436 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ use bend::{ }; use clap::{Args, CommandFactory, Parser, Subcommand}; use std::path::{Path, PathBuf}; +use std::process::ExitCode; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] @@ -222,15 +223,18 @@ pub enum WarningArgs { RecursionCycle, } -fn main() { +fn main() -> ExitCode { #[cfg(not(feature = "cli"))] compile_error!("The 'cli' feature is needed for the hvm-lang cli"); let cli = Cli::parse(); if let Err(diagnostics) = execute_cli_mode(cli) { - eprint!("{diagnostics}") + eprint!("{diagnostics}"); + return ExitCode::FAILURE; } + + ExitCode::SUCCESS } fn execute_cli_mode(mut cli: Cli) -> Result<(), Diagnostics> { From 9e165a2c85d00f21ffcc1d9d55e2448e1d4fdf0d Mon Sep 17 00:00:00 2001 From: PfaulJulian Date: Sat, 18 May 2024 15:25:07 +0200 Subject: [PATCH 2/2] ran cargo fmt for indentation --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2e9cf436..8c9de972 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,8 +5,10 @@ use bend::{ load_file_to_book, run_book_with_fn, CompileOpts, OptLevel, RunOpts, }; use clap::{Args, CommandFactory, Parser, Subcommand}; -use std::path::{Path, PathBuf}; -use std::process::ExitCode; +use std::{ + path::{Path, PathBuf}, + process::ExitCode, +}; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)]