all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-datacenter-manager 4/4] resources: Remove unnecessary closure
Date: Mon, 13 Jan 2025 13:08:31 +0100	[thread overview]
Message-ID: <20250113120831.299244-4-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20250113120831.299244-1-m.sandoval@proxmox.com>

warning: unnecessary closure used to substitute value for `Option::None`
   --> server/src/api/resources.rs:322:21
    |
322 |     let timeframe = timeframe.unwrap_or_else(|| RrdTimeframe::Day);
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
    = note: `#[warn(clippy::unnecessary_lazy_evaluations)]` on by default
help: use `unwrap_or` instead
    |
322 |     let timeframe = timeframe.unwrap_or(RrdTimeframe::Day);

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 server/src/api/resources.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index f6438c6..453d9e8 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -319,7 +319,7 @@ pub async fn get_subscription_status(
 async fn get_top_entities(timeframe: Option<RrdTimeframe>) -> Result<TopEntities, Error> {
     let (remotes_config, _) = pdm_config::remotes::config()?;
 
-    let timeframe = timeframe.unwrap_or_else(|| RrdTimeframe::Day);
+    let timeframe = timeframe.unwrap_or(RrdTimeframe::Day);
     let res = crate::metric_collection::calculate_top(&remotes_config.sections, timeframe, 10);
     Ok(res)
 }
-- 
2.39.5



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


  parent reply	other threads:[~2025-01-13 12:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 12:08 [pdm-devel] [PATCH proxmox-datacenter-manager 1/4] elide lifetimes in traits when possible Maximiliano Sandoval
2025-01-13 12:08 ` [pdm-devel] [PATCH proxmox-datacenter-manager 2/4] remove needless borrows Maximiliano Sandoval
2025-01-13 12:08 ` [pdm-devel] [PATCH proxmox-datacenter-manager 3/4] task_cache: Do field assigment inside initializer Maximiliano Sandoval
2025-01-13 12:08 ` Maximiliano Sandoval [this message]
2025-01-13 12:15 ` [pdm-devel] applied: [PATCH proxmox-datacenter-manager 1/4] elide lifetimes in traits when possible Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250113120831.299244-4-m.sandoval@proxmox.com \
    --to=m.sandoval@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal