From 5015459966140ef348c7b3a9146fe2e28721e015 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Fri, 5 Jan 2024 03:49:11 +0100 Subject: [PATCH] refactor: replace match with method call --- src/config.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/config.rs b/src/config.rs index 1f731ce..a520ef4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -27,13 +27,12 @@ impl Config { } fn get_config_file() -> String { - match env::args().nth(1) { - Some(config_file) => config_file, - None => format!( + env::args().nth(1).unwrap_or_else(|| { + format!( "{}/.checkbar.toml", dirs::home_dir().unwrap().to_str().unwrap_or("") - ), - } + ) + }) } pub fn read() -> Self {