[pdm-devel] [PATCH proxmox-datacenter-manager 4/4] resources: Remove unnecessary closure

Maximiliano Sandoval m.sandoval at proxmox.com
Mon Jan 13 13:08:31 CET 2025


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 at 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





More information about the pdm-devel mailing list