Skip to content

Commit

Permalink
chore: cleanup matches with if let
Browse files Browse the repository at this point in the history
  • Loading branch information
rawkode committed May 18, 2021
1 parent 2e8d8fb commit db23ba1
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,21 @@ pub fn load_config(opts: Opt) -> Result<Config> {

fn find_configs() -> Option<PathBuf> {
// Check current working directory first
match std::env::current_dir() {
Ok(cwd) => {
let local_config = cwd.join("Comtrya.yaml");
if let Ok(cwd) = std::env::current_dir() {
let local_config = cwd.join("Comtrya.yaml");

if true == local_config.is_file() {
return Some(local_config);
}
if true == local_config.is_file() {
return Some(local_config);
}
Err(_) => {}
};
}

// Check platform's config dir
match dirs_next::config_dir() {
Some(config_dir) => {
let local_config = config_dir.join("Comtrya.yaml");
if let Some(config_dir) = dirs_next::config_dir() {
let local_config = config_dir.join("Comtrya.yaml");

if true == local_config.is_file() {
return Some(local_config);
}
if true == local_config.is_file() {
return Some(local_config);
}
None => {}
};

None
Expand Down

0 comments on commit db23ba1

Please sign in to comment.