Skip to content

Commit

Permalink
Remove nested of ifs with and_then
Browse files Browse the repository at this point in the history
  • Loading branch information
idursun committed Aug 21, 2020
1 parent 238a2a8 commit 4c10a7a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/adapters/executor/file_system_executor.rs
Expand Up @@ -63,12 +63,13 @@ where
}
let dest_dir = target.parent().expect("Failed to get parent directory");

if fs::create_dir_all(&dest_dir).is_ok() {
if fs::copy(source.as_path(), target.as_path()).is_ok() {
fs::create_dir_all(&dest_dir)
.and_then(|_| fs::copy(source.as_path(), target.as_path()))
.and_then(|_| {
self.logger
.print(format!("{} {}", "Copy".blue(), source.display()));
}
}
Ok(())
})?;
}
Ok(())
}
Expand Down

0 comments on commit 4c10a7a

Please sign in to comment.