diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-03-27 11:10:34 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-03-27 11:10:34 +0200 |
commit | 0483cfcc6f85711b7b75fc8f0182e4baf7c0019f (patch) | |
tree | 0c8851d2b95dd55253446076894210122134a815 /src/client.rs | |
parent | 96cab4a2fda6726437403b00cfcba1ee69bc9432 (diff) | |
download | obnam2-0483cfcc6f85711b7b75fc8f0182e4baf7c0019f.tar.gz |
refactor: use Option::or_else to avoid unnecessary allocation
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/client.rs b/src/client.rs index c054aca..80ae788 100644 --- a/src/client.rs +++ b/src/client.rs @@ -71,7 +71,10 @@ impl ClientConfig { roots: tentative.roots, verify_tls_cert: tentative.verify_tls_cert.or(Some(false)).unwrap(), chunk_size: tentative.chunk_size.or(Some(DEFAULT_CHUNK_SIZE)).unwrap(), - log: tentative.log.or(Some(PathBuf::from(DEVNULL))).unwrap(), + log: tentative + .log + .or_else(|| Some(PathBuf::from(DEVNULL))) + .unwrap(), }; config.check()?; |