From dbb8fbcd84ca3879f173d8b2520c68040da4da5b Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 7 Apr 2021 15:51:11 -0400 Subject: [PATCH] Fixing clippy --- crates/utils/src/settings/structs.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/utils/src/settings/structs.rs b/crates/utils/src/settings/structs.rs index d1949a317..3863f6e3c 100644 --- a/crates/utils/src/settings/structs.rs +++ b/crates/utils/src/settings/structs.rs @@ -40,26 +40,26 @@ impl DatabaseConfig { self .user .to_owned() - .unwrap_or(DatabaseConfig::default().user.expect("missing user")) + .unwrap_or_else(|| DatabaseConfig::default().user.expect("missing user")) } pub fn port(&self) -> i32 { self .port - .unwrap_or(DatabaseConfig::default().port.expect("missing port")) + .unwrap_or_else(|| DatabaseConfig::default().port.expect("missing port")) } pub fn database(&self) -> String { - self.database.to_owned().unwrap_or( + self.database.to_owned().unwrap_or_else(|| { DatabaseConfig::default() .database - .expect("missing database"), - ) + .expect("missing database") + }) } pub fn pool_size(&self) -> u32 { - self.pool_size.unwrap_or( + self.pool_size.unwrap_or_else(|| { DatabaseConfig::default() .pool_size - .expect("missing pool_size"), - ) + .expect("missing pool_size") + }) } }