mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-27 02:03:52 +01:00
Simplify Optional handling
This commit is contained in:
parent
54143d1403
commit
972a764a74
10
src/dirs.rs
10
src/dirs.rs
@ -25,10 +25,7 @@ impl BatProjectDirs {
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let cache_dir_op = dirs_rs::cache_dir();
|
||||
|
||||
let cache_dir = match cache_dir_op {
|
||||
Some(d) => d.join("bat"),
|
||||
None => return None,
|
||||
};
|
||||
let cache_dir = cache_dir_op.map(|d| d.join("bat"))?;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
let config_dir_op = env::var_os("XDG_CONFIG_HOME")
|
||||
@ -39,10 +36,7 @@ impl BatProjectDirs {
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let config_dir_op = dirs_rs::config_dir();
|
||||
|
||||
let config_dir = match config_dir_op {
|
||||
Some(d) => d.join("bat"),
|
||||
None => return None,
|
||||
};
|
||||
let config_dir = config_dir_op.map(|d| d.join("bat"))?;
|
||||
|
||||
Some(BatProjectDirs {
|
||||
cache_dir,
|
||||
|
Loading…
Reference in New Issue
Block a user