mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-05 07:27:46 +00:00
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.
This commit is contained in:
parent
1755195251
commit
4fbb741314
1 changed files with 0 additions and 30 deletions
|
@ -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_export]
|
||||||
macro_rules! safe_write(
|
macro_rules! safe_write(
|
||||||
($fd:expr, $($args:tt)+) => (
|
($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
|
||||||
|
|
||||||
//-- message templates : (join utility sub-macros)
|
//-- message templates : (join utility sub-macros)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue