fix arithmetic side-effects
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
52a561ff9e
commit
7397064edd
25 changed files with 139 additions and 114 deletions
|
@ -65,7 +65,10 @@ impl Data {
|
|||
"counter mismatch"
|
||||
);
|
||||
|
||||
*counter = counter.wrapping_add(1);
|
||||
*counter = counter
|
||||
.checked_add(1)
|
||||
.expect("counter must not overflow u64");
|
||||
|
||||
self.global.insert(COUNTER, &counter.to_be_bytes())?;
|
||||
|
||||
Ok(*counter)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue