From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yew-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 786F41FF15E
	for <inbox@lore.proxmox.com>; Tue, 14 Jan 2025 10:10:11 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 2B3A9104E1;
	Tue, 14 Jan 2025 10:09:54 +0100 (CET)
From: Shannon Sterz <s.sterz@proxmox.com>
To: yew-devel@lists.proxmox.com
Date: Tue, 14 Jan 2025 10:09:39 +0100
Message-Id: <20250114090940.29366-2-s.sterz@proxmox.com>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250114090940.29366-1-s.sterz@proxmox.com>
References: <20250114090940.29366-1-s.sterz@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.083 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [rust-lang.github.io]
 URIBL_SBL_A 0.1 Contains URL's A record listed in the Spamhaus SBL blocklist
 [185.199.111.153, 185.199.110.153, 185.199.108.153, 185.199.109.153]
Subject: [yew-devel] [PATCH yew-comp 2/3] tree wide: implement `Default` for
 `new()` functions without parameter
X-BeenThere: yew-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Yew framework devel list at Proxmox <yew-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/yew-devel>, 
 <mailto:yew-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/yew-devel/>
List-Post: <mailto:yew-devel@lists.proxmox.com>
List-Help: <mailto:yew-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel>, 
 <mailto:yew-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Yew framework devel list at Proxmox <yew-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: yew-devel-bounces@lists.proxmox.com
Sender: "yew-devel" <yew-devel-bounces@lists.proxmox.com>

this allows usage of functions like `unwrap_or_default` for these
types and fixes the clippy lint `new_without_default`.

[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 src/apt_package_manager.rs        | 6 ++++++
 src/apt_repositories.rs           | 6 ++++++
 src/configuration/network_view.rs | 6 ++++++
 src/rrd_timeframe_selector.rs     | 6 ++++++
 4 files changed, 24 insertions(+)

diff --git a/src/apt_package_manager.rs b/src/apt_package_manager.rs
index 11d7eb8..18454ed 100644
--- a/src/apt_package_manager.rs
+++ b/src/apt_package_manager.rs
@@ -46,6 +46,12 @@ pub struct AptPackageManager {
     pub enable_upgrade: bool,
 }
 
+impl Default for AptPackageManager {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
 impl AptPackageManager {
     pub fn new() -> Self {
         yew::props!(Self {})
diff --git a/src/apt_repositories.rs b/src/apt_repositories.rs
index 7149545..b671d01e 100644
--- a/src/apt_repositories.rs
+++ b/src/apt_repositories.rs
@@ -49,6 +49,12 @@ pub struct AptRepositories {
     pub product: Option<ExistingProduct>,
 }
 
+impl Default for AptRepositories {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
 impl AptRepositories {
     pub fn new() -> Self {
         yew::props!(Self {})
diff --git a/src/configuration/network_view.rs b/src/configuration/network_view.rs
index fa9f985..d7d519c 100644
--- a/src/configuration/network_view.rs
+++ b/src/configuration/network_view.rs
@@ -52,6 +52,12 @@ async fn apply_changes() -> Result<String, Error> {
 #[derive(PartialEq, Properties)]
 pub struct NetworkView {}
 
+impl Default for NetworkView {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
 impl NetworkView {
     pub fn new() -> Self {
         Self {}
diff --git a/src/rrd_timeframe_selector.rs b/src/rrd_timeframe_selector.rs
index d674f7c..5758a04 100644
--- a/src/rrd_timeframe_selector.rs
+++ b/src/rrd_timeframe_selector.rs
@@ -28,6 +28,12 @@ pub struct RRDTimeframeSelector {
     on_change: Option<Callback<RRDTimeframe>>,
 }
 
+impl Default for RRDTimeframeSelector {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
 impl RRDTimeframeSelector {
     pub fn new() -> Self {
         yew::props!(Self {})
-- 
2.39.5



_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel