From 2b9fb32de174c5b546cb0001d98504a30e6a5786 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 14 Oct 2021 16:10:55 +0200 Subject: [PATCH] proxmox-rrd: cleanup - use staturating_add instead of if/else --- proxmox-rrd/src/rrd.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/proxmox-rrd/src/rrd.rs b/proxmox-rrd/src/rrd.rs index 60dfad7c..5dda00aa 100644 --- a/proxmox-rrd/src/rrd.rs +++ b/proxmox-rrd/src/rrd.rs @@ -219,11 +219,7 @@ impl RRA { self.last_count = 0; } - let new_count = if self.last_count < u64::MAX { - self.last_count + 1 - } else { - u64::MAX // should never happen - }; + let new_count = self.last_count.saturating_add(1); if self.last_count == 0 { self.data[index] = value;