From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pdm-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 CE53C1FF173
	for <inbox@lore.proxmox.com>; Mon, 13 Jan 2025 13:09:21 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 7FFE82DA1F;
	Mon, 13 Jan 2025 13:09:05 +0100 (CET)
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pdm-devel@lists.proxmox.com
Date: Mon, 13 Jan 2025 13:08:30 +0100
Message-Id: <20250113120831.299244-3-m.sandoval@proxmox.com>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250113120831.299244-1-m.sandoval@proxmox.com>
References: <20250113120831.299244-1-m.sandoval@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.095 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
 POISEN_SPAM_PILL          0.1 Meta: its spam
 POISEN_SPAM_PILL_1        0.1 random spam to be learned in bayes
 POISEN_SPAM_PILL_3        0.1 random spam to be learned in bayes
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_SBL_A 0.1 Contains URL's A record listed in the Spamhaus SBL blocklist
 [185.199.110.153, 185.199.109.153, 185.199.111.153, 185.199.108.153]
Subject: [pdm-devel] [PATCH proxmox-datacenter-manager 3/4] task_cache: Do
 field assigment inside initializer
X-BeenThere: pdm-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Datacenter Manager development discussion
 <pdm-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pdm-devel>, 
 <mailto:pdm-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pdm-devel/>
List-Post: <mailto:pdm-devel@lists.proxmox.com>
List-Help: <mailto:pdm-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel>, 
 <mailto:pdm-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox Datacenter Manager development discussion
 <pdm-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pdm-devel-bounces@lists.proxmox.com
Sender: "pdm-devel" <pdm-devel-bounces@lists.proxmox.com>

Fixes:

warning: field assignment outside of initializer for an instance created with Default::default()
  --> server/src/task_cache.rs:78:17
   |
78 |                 params.source = Some(ListTasksSource::All);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: consider initializing the variable with `pve_api_types::ListTasks { source: Some(ListTasksSource::All), since: Some(proxmox_time::epoch_i64() - 7 * 24 * 60 * 60), ..Default::default() }` and removing relevant reassignments
  --> server/src/task_cache.rs:76:17
   |
76 |                 let mut params = ListTasks::default();
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
   = note: `#[warn(clippy::field_reassign_with_default)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 server/src/task_cache.rs | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/server/src/task_cache.rs b/server/src/task_cache.rs
index 2d3c9b6..3ef24b1 100644
--- a/server/src/task_cache.rs
+++ b/server/src/task_cache.rs
@@ -73,12 +73,14 @@ async fn fetch_tasks(remote: &Remote) -> Result<Vec<TaskListItem>, Error> {
             // N+1 requests - we could use /cluster/tasks, but that one
             // only gives a limited task history
             for node in client.list_nodes().await? {
-                let mut params = ListTasks::default();
-                // Include running tasks
-                params.source = Some(ListTasksSource::All);
-                // TODO: How much task history do we want? Right now we just hard-code it
-                // to 7 days.
-                params.since = Some(proxmox_time::epoch_i64() - 7 * 24 * 60 * 60);
+                let params = ListTasks {
+                    // Include running tasks
+                    source: Some(ListTasksSource::All),
+                    // TODO: How much task history do we want? Right now we just hard-code it
+                    // to 7 days.
+                    since: Some(proxmox_time::epoch_i64() - 7 * 24 * 60 * 60),
+                    ..Default::default()
+                };
 
                 let list = client.get_task_list(&node.node, params).await?;
                 let mapped = map_tasks(list, &remote.id)?;
-- 
2.39.5



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