From 21cd5d68bd6d7b094334b3d15cd66203bc8474f5 Mon Sep 17 00:00:00 2001 From: simonsan <14062932+simonsan@users.noreply.github.com> Date: Fri, 30 Jun 2023 13:32:18 +0200 Subject: [PATCH] refactor: Use Option::map_or() --- src/config.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 162c9874e..64eda408d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -131,13 +131,11 @@ fn get_config_paths(filename: &str) -> Vec { #[cfg(target_os = "windows")] fn get_global_config_path() -> Option { - if let Some(program_data) = std::env::var_os("PROGRAMDATA") { + std::env::var_os("PROGRAMDATA").map_or(None, |program_data| { let mut path = PathBuf::from(program_data); path.push(r"rustic\config"); Some(path) - } else { - None - } + }) } #[cfg(any(target_os = "ios", target_arch = "wasm32"))]