mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-17 02:51:44 +00:00
clippy: collapse/rework nested ifs
no semantic changes (intended). Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
4d8bd987a4
commit
655ceac1c6
@ -128,25 +128,20 @@ impl RRA {
|
||||
// derive counter value
|
||||
if self.flags.intersects(RRAFlags::DST_DERIVE | RRAFlags::DST_COUNTER) {
|
||||
let time_diff = time - self.last_update;
|
||||
let is_counter = self.flags.contains(RRAFlags::DST_COUNTER);
|
||||
|
||||
let diff = if self.counter_value.is_nan() {
|
||||
0.0
|
||||
} else if is_counter && value < 0.0 {
|
||||
eprintln!("rrdb update failed - got negative value for counter");
|
||||
return;
|
||||
} else if is_counter && value < self.counter_value {
|
||||
// Note: We do not try automatic overflow corrections
|
||||
self.counter_value = value;
|
||||
eprintln!("rrdb update failed - conter overflow/reset detected");
|
||||
return;
|
||||
} else {
|
||||
if self.flags.contains(RRAFlags::DST_COUNTER) { // check for overflow
|
||||
if value < 0.0 {
|
||||
eprintln!("rrdb update failed - got negative value for counter");
|
||||
return;
|
||||
}
|
||||
// Note: We do not try automatic overflow corrections
|
||||
if value < self.counter_value { // overflow or counter reset
|
||||
self.counter_value = value;
|
||||
eprintln!("rrdb update failed - conter overflow/reset detected");
|
||||
return;
|
||||
} else {
|
||||
value - self.counter_value
|
||||
}
|
||||
} else {
|
||||
value - self.counter_value
|
||||
}
|
||||
value - self.counter_value
|
||||
};
|
||||
self.counter_value = value;
|
||||
value = diff/time_diff;
|
||||
|
Loading…
Reference in New Issue
Block a user