From 4fbb74131427ff9d1f162f6eeb37ee4b84b43a9b Mon Sep 17 00:00:00 2001 From: Andreas Hartmann Date: Mon, 23 Aug 2021 12:02:11 +0200 Subject: [PATCH] macros: Remove obsolete macros Removes the `return_if_err!` and `safe_unwrap!` macros, which have now been replaces by `crash_if_err!` throughout the whole code and thus aren't used any longer. --- src/uucore/src/lib/macros.rs | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index d16f04504..c7b15dba3 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -99,24 +99,6 @@ macro_rules! crash_if_err( //==== -/// Unwraps the Result. Instead of panicking, it shows the error and then -/// returns from the function with the provided exit code. -/// Assumes the current function returns an i32 value. -#[macro_export] -macro_rules! return_if_err( - ($exit_code:expr, $exp:expr) => ( - match $exp { - Ok(m) => m, - Err(f) => { - $crate::show_error!("{}", f); - return $exit_code; - } - } - ) -); - -//==== - #[macro_export] macro_rules! safe_write( ($fd:expr, $($args:tt)+) => ( @@ -137,18 +119,6 @@ macro_rules! safe_writeln( ) ); -/// Unwraps the Result. Instead of panicking, it exists the program with exit -/// code 1. -#[macro_export] -macro_rules! safe_unwrap( - ($exp:expr) => ( - match $exp { - Ok(m) => m, - Err(f) => $crate::crash!(1, "{}", f.to_string()) - } - ) -); - //-- message templates //-- message templates : (join utility sub-macros)