From 902609b7d8df796dc11fff9c34ad969967ff9580 Mon Sep 17 00:00:00 2001 From: Jordan MacDonald Date: Sat, 6 Apr 2024 23:37:47 -0400 Subject: [PATCH] Use ? operator instead of returning none --- src/models/application/preferences/mod.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/models/application/preferences/mod.rs b/src/models/application/preferences/mod.rs index fb48b42d..9898e5d6 100644 --- a/src/models/application/preferences/mod.rs +++ b/src/models/application/preferences/mod.rs @@ -321,13 +321,10 @@ impl Preferences { let extension = path_extension(Some(path))?; // Build a command using the command sub-key. - let Some(program) = self + let program = self .data .as_ref() - .and_then(|data| data[TYPES_KEY][extension][FORMAT_TOOL_KEY]["command"].as_str()) - else { - return None; - }; + .and_then(|data| data[TYPES_KEY][extension][FORMAT_TOOL_KEY]["command"].as_str())?; let mut command = process::Command::new(program); // Parse and add options to command, if present.