For the given code paths, the amount of space used in the previous chunk
is irrelevant.
(This will almost never make a difference to behaviour, but it makes the
code clearer.)
new_capacity = last_chunk.storage.capacity();
loop {
new_capacity = new_capacity.checked_mul(2).unwrap();
- if new_capacity >= currently_used_cap + n {
+ if new_capacity >= n {
break;
}
}
new_capacity = last_chunk.storage.capacity();
loop {
new_capacity = new_capacity.checked_mul(2).unwrap();
- if new_capacity >= used_bytes + needed_bytes {
+ if new_capacity >= needed_bytes {
break;
}
}