From c922bf23f683ffca1b11b98ad4ab31aa81f50b1a Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 14 Mar 2022 10:06:29 +0000 Subject: [PATCH] performance-metrics: Use non-zero exit code on report file issues This removes the need to wrap an error that is never used. Signed-off-by: Rob Bradford --- performance-metrics/src/main.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/performance-metrics/src/main.rs b/performance-metrics/src/main.rs index 670886b4b..cbd1fd6cc 100644 --- a/performance-metrics/src/main.rs +++ b/performance-metrics/src/main.rs @@ -22,10 +22,6 @@ enum Error { TestTimeout, #[error("Error: test failed")] TestFailed, - #[error("Error creating log file: {0}")] - ReportFileCreation(std::io::Error), - #[error("Error writing log file: {0}")] - ReportFileWrite(std::io::Error), } #[derive(Deserialize, Serialize)] @@ -489,7 +485,10 @@ fn main() { if let Some(file) = cmd_arguments.value_of("report-file") { Box::new( std::fs::File::create(std::path::Path::new(file)) - .map_err(Error::ReportFileCreation) + .map_err(|e| { + eprintln!("Error opening report file: {}: {}", file, e); + std::process::exit(1); + }) .unwrap(), ) } else { @@ -502,6 +501,9 @@ fn main() { .unwrap() .as_bytes(), ) - .map_err(Error::ReportFileWrite) + .map_err(|e| { + eprintln!("Error writing report file: {}", e); + std::process::exit(1); + }) .unwrap(); }