From 0483cfcc6f85711b7b75fc8f0182e4baf7c0019f Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 27 Mar 2021 11:10:34 +0200 Subject: refactor: use Option::or_else to avoid unnecessary allocation --- src/client.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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()?; -- cgit v1.2.1