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 <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-10-18 19:41:55 +02:00
parent 4197e94e25
commit ba59b84d46

View File

@ -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)?;