Skip to content

Commit 441b079

Browse files
committed
address review comments
Signed-off-by: ylzh10 <[email protected]>
1 parent 7aac554 commit 441b079

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/address_allocator.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,19 @@ impl AddressAllocator {
6767
) -> Result<RangeInclusive> {
6868
let constraint = Constraint::new(size, alignment, policy)?;
6969
let allocated = self.interval_tree.allocate(constraint)?;
70-
self.used.checked_add(allocated.len() as usize).expect("Failed to calculate used memory");
70+
self.used
71+
.checked_add(allocated.len() as usize)
72+
.expect("Failed to calculate used memory");
7173
Ok(allocated)
7274
}
7375

7476
/// Deletes the specified memory slot or returns `ResourceNotAvailable` if
7577
/// the node was not allocated before.
7678
pub fn free(&mut self, key: &RangeInclusive) -> Result<()> {
7779
self.interval_tree.free(key)?;
78-
self.used.checked_sub(key.len() as usize).expect("Failed to calculate used memory");
80+
self.used
81+
.checked_sub(key.len() as usize)
82+
.expect("Failed to calculate used memory");
7983
Ok(())
8084
}
8185

0 commit comments

Comments
 (0)