From 9a4af87669e43d5e7583a73e718f0c5e04718e86 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 8 Nov 2020 19:38:17 +0800 Subject: [PATCH] chore: use less mut variable --- src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index eb6211a..92cb136 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,9 +54,8 @@ fn main() { })); 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 { - the_file_lock = match FileLock::lock(lock_file, false, true) { + let the_file_lock = if let Some(ref lock_file) = keep_running_config.lock_file { + match FileLock::lock(lock_file, false, true) { Ok(lock) => { info!("Lock file success: {}", lock_file); Some(lock) @@ -65,8 +64,8 @@ fn main() { warn!("Lock file failed: {}", lock_file); return; }, - }; - } + } + } else { None }; init_logger();