From 8bd4ffca56169d9f2c20bf5e14a2688fd6bce5ae Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 4 Mar 2019 11:37:34 +0100 Subject: [PATCH] simplify macros --- src/lib.rs | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b238c67..902c51a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -684,15 +684,9 @@ macro_rules! cherr { ( None, $fmt:expr, $($arg:tt)+ ) => ({ cherr!(None, format!($fmt, $($arg)+ )) }); - ( $e:ident, $k:expr ) => ({ - ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!()))) - }); ( $e:path, $k:expr ) => ({ ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!()))) }); - ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({ - cherr!($e, format!($fmt, $($arg)+ )) - }); ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({ cherr!($e, format!($fmt, $($arg)+ )) }); @@ -787,21 +781,12 @@ macro_rules! cherr { /// ~~~ #[macro_export] macro_rules! mstrerr { - ( $t:ident, $msg:expr ) => ({ - |e| cherr!(e, $t ($msg.to_string())) - }); ( $t:path, $msg:expr ) => ({ |e| cherr!(e, $t ($msg.to_string())) }); - ( $t:ident, $msg:expr, ) => ({ - |e| cherr!(e, $t ($msg.to_string())) - }); ( $t:path, $msg:expr, ) => ({ |e| cherr!(e, $t ($msg.to_string())) }); - ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({ - |e| cherr!(e, $t (format!($fmt, $($arg)+ ))) - }); ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({ |e| cherr!(e, $t (format!($fmt, $($arg)+ ))) }); @@ -854,21 +839,12 @@ macro_rules! mstrerr { /// ~~~ #[macro_export] macro_rules! strerr { - ( $t:ident, $msg:expr ) => ({ - cherr!($t ($msg.to_string())) - }); ( $t:path, $msg:expr ) => ({ cherr!($t ($msg.to_string())) }); - ( $t:ident, $msg:expr, ) => ({ - cherr!($t ($msg.to_string())) - }); ( $t:path, $msg:expr, ) => ({ cherr!($t ($msg.to_string())) }); - ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({ - cherr!($t (format!($fmt, $($arg)+ ))) - }); ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({ cherr!($t (format!($fmt, $($arg)+ ))) });