Skip to content

Commit

Permalink
Use ? operator instead of returning none
Browse files Browse the repository at this point in the history
  • Loading branch information
jmacdonald committed Apr 7, 2024
1 parent 23ff429 commit 902609b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/models/application/preferences/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 902609b

Please sign in to comment.