From 17c7b46a6959aae02fc7573282429ed606d5a16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 19 Jan 2021 11:31:37 +0100 Subject: [PATCH] clippy: use unwrap_or_default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabian Grünbichler --- src/bin/proxmox-backup-proxy.rs | 2 +- src/config/network.rs | 2 +- src/config/network/parser.rs | 4 ++-- src/server/email_notifications.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index bb2be243..92f6f67c 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -749,7 +749,7 @@ async fn generate_host_stats(save: bool) { match datastore::config() { Ok((config, _)) => { let datastore_list: Vec = - config.convert_to_typed_array("datastore").unwrap_or(Vec::new()); + config.convert_to_typed_array("datastore").unwrap_or_default(); for config in datastore_list { diff --git a/src/config/network.rs b/src/config/network.rs index 39f41c7e..fbfef052 100644 --- a/src/config/network.rs +++ b/src/config/network.rs @@ -515,7 +515,7 @@ pub fn config() -> Result<(NetworkConfig, [u8;32]), Error> { Some(content) => content, None => { let content = proxmox::tools::fs::file_get_optional_contents(NETWORK_INTERFACES_FILENAME)?; - content.unwrap_or(Vec::new()) + content.unwrap_or_default() } }; diff --git a/src/config/network/parser.rs b/src/config/network/parser.rs index 246ce05d..2546f027 100644 --- a/src/config/network/parser.rs +++ b/src/config/network/parser.rs @@ -215,12 +215,12 @@ impl NetworkParser { Token::Comment => { let comment = self.eat(Token::Comment)?; if !address_family_v4 && address_family_v6 { - let mut comments = interface.comments6.take().unwrap_or(String::new()); + let mut comments = interface.comments6.take().unwrap_or_default(); if !comments.is_empty() { comments.push('\n'); } comments.push_str(&comment); interface.comments6 = Some(comments); } else { - let mut comments = interface.comments.take().unwrap_or(String::new()); + let mut comments = interface.comments.take().unwrap_or_default(); if !comments.is_empty() { comments.push('\n'); } comments.push_str(&comment); interface.comments = Some(comments); diff --git a/src/server/email_notifications.rs b/src/server/email_notifications.rs index 9a31f628..f35d1b94 100644 --- a/src/server/email_notifications.rs +++ b/src/server/email_notifications.rs @@ -434,7 +434,7 @@ pub fn lookup_datastore_notify_settings( None => lookup_user_email(Userid::root_userid()), }; - let notify_str = config.notify.unwrap_or(String::new()); + let notify_str = config.notify.unwrap_or_default(); if let Ok(value) = parse_property_string(¬ify_str, &DatastoreNotify::API_SCHEMA) { if let Ok(notify) = serde_json::from_value(value) {