proxmox-rrd: cleanup - use staturating_add instead of if/else

This commit is contained in:
Dietmar Maurer 2021-10-14 16:10:55 +02:00
parent a9017805b7
commit f28a713e2b
1 changed files with 1 additions and 5 deletions

View File

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