summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-03-27 11:10:34 +0200
committerLars Wirzenius <liw@liw.fi>2021-03-27 11:10:34 +0200
commit0483cfcc6f85711b7b75fc8f0182e4baf7c0019f (patch)
tree0c8851d2b95dd55253446076894210122134a815
parent96cab4a2fda6726437403b00cfcba1ee69bc9432 (diff)
downloadobnam2-0483cfcc6f85711b7b75fc8f0182e4baf7c0019f.tar.gz
refactor: use Option::or_else to avoid unnecessary allocation
-rw-r--r--src/client.rs5
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()?;