From ba59b84d464d297bea2b0fbefc1d44759cfaa0e9 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 18 Oct 2023 19:41:55 +0200 Subject: [PATCH] rest-server: code complexity clean-up in task-log rotation avoid using the negative in the if check and extract the value to be passed upfront. Signed-off-by: Thomas Lamprecht --- proxmox-rest-server/src/worker_task.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/proxmox-rest-server/src/worker_task.rs b/proxmox-rest-server/src/worker_task.rs index fd052c8a..c0b99b78 100644 --- a/proxmox-rest-server/src/worker_task.rs +++ b/proxmox-rest-server/src/worker_task.rs @@ -251,12 +251,9 @@ pub fn rotate_task_log_archive( let _lock = setup.lock_task_list_files(true)?; - let mut logrotate = LogRotate::new( - &setup.task_archive_fn, - compress, - if max_days.is_none() { max_files } else { None }, - options, - )?; + let max_files = if max_days.is_some() { None } else { max_files }; + + let mut logrotate = LogRotate::new(&setup.task_archive_fn, compress, max_files, options)?; let mut rotated = logrotate.rotate(size_threshold)?;