mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 12:11:59 +00:00
[refactor] Refactor Option/Result combinators (#3180)
Code simplifications using `Option`/`Result` combinators to make pattern-matches a tad simpler. Opinions on these loosely held, happy to adjust in review. Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust).
This commit is contained in:
@@ -149,10 +149,8 @@ impl Config {
|
||||
pub fn get_existing_legacy_data_dir(&self) -> Option<PathBuf> {
|
||||
dirs::home_dir()
|
||||
.map(|home_dir| home_dir.join(&self.data_dir))
|
||||
// Return `None` if the directory does not exists.
|
||||
.filter(|dir| dir.exists())
|
||||
// Return `None` if the legacy directory is identical to the modern.
|
||||
.filter(|dir| *dir != self.get_modern_data_dir())
|
||||
// Return `None` if the legacy directory does not exist or if it is identical to the modern.
|
||||
.filter(|dir| dir.exists() && *dir != self.get_modern_data_dir())
|
||||
}
|
||||
|
||||
/// Returns the core path for the client.
|
||||
|
||||
Reference in New Issue
Block a user