chore: use less mut variable

This commit is contained in:
2020-11-08 19:38:17 +08:00
parent 6bd539cdbd
commit 9a4af87669

View File

@@ -54,9 +54,8 @@ fn main() {
})); }));
let keep_running_config = opt_value!(parse_keep_running_config()); let keep_running_config = opt_value!(parse_keep_running_config());
let mut the_file_lock = None; let the_file_lock = if let Some(ref lock_file) = keep_running_config.lock_file {
if let Some(ref lock_file) = keep_running_config.lock_file { match FileLock::lock(lock_file, false, true) {
the_file_lock = match FileLock::lock(lock_file, false, true) {
Ok(lock) => { Ok(lock) => {
info!("Lock file success: {}", lock_file); info!("Lock file success: {}", lock_file);
Some(lock) Some(lock)
@@ -65,8 +64,8 @@ fn main() {
warn!("Lock file failed: {}", lock_file); warn!("Lock file failed: {}", lock_file);
return; return;
}, },
};
} }
} else { None };
init_logger(); init_logger();