diff --git a/src/main.rs b/src/main.rs index 72a8b64..3e90d99 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,14 +35,20 @@ lazy_static!{ static ref CHECK_FAIL_MAP: Mutex> = Mutex::new(HashMap::new()); } +macro_rules! opt_value { + ($e: expr) => { + match $e { + Some(o) => o, + None => return, + } + } +} fn main() { panic::set_hook(Box::new(|panic_info| { error!("Panic in running keeprunningd: {:?}", panic_info); })); - let keep_running_config = match parse_keep_running_config() { - Some(c) => c, None => return, - }; + let keep_running_config = opt_value!(parse_keep_running_config()); let mut the_file_lock = None; if let Some(ref lock_file) = keep_running_config.lock_file {