Skip to content

Commit

Permalink
Remove another match boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter authored and nickgerace committed Dec 9, 2024
1 parent 168bdc4 commit 16fc296
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bin/gfold/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ impl Config {
let home = dirs::home_dir().ok_or(ConfigError::HomeDirNotFound)?;
let path = home.join(".config").join("gfold.toml");
let entry_config = match fs::read_to_string(path) {
Ok(contents) => match contents.is_empty() {
true => EntryConfig::default(),
false => toml::from_str(&contents)?,
},
Ok(contents) => {
if contents.is_empty() {
EntryConfig::default()
} else {
toml::from_str(&contents)?
}
}
Err(e) => match e.kind() {
io::ErrorKind::NotFound => EntryConfig::default(),
_ => return Err(e.into()),
Expand Down

0 comments on commit 16fc296

Please sign in to comment.