refactor confusing loop in proc_macro arena
This commit is contained in:
parent
0a6462be90
commit
74ec42e000
1 changed files with 6 additions and 7 deletions
|
|
@ -90,14 +90,13 @@ impl Arena {
|
|||
return &mut [];
|
||||
}
|
||||
|
||||
loop {
|
||||
if let Some(a) = self.alloc_raw_without_grow(bytes) {
|
||||
break a;
|
||||
}
|
||||
// No free space left. Allocate a new chunk to satisfy the request.
|
||||
// On failure the grow will panic or abort.
|
||||
self.grow(bytes);
|
||||
if let Some(a) = self.alloc_raw_without_grow(bytes) {
|
||||
return a;
|
||||
}
|
||||
// No free space left. Allocate a new chunk to satisfy the request.
|
||||
// On failure the grow will panic or abort.
|
||||
self.grow(bytes);
|
||||
self.alloc_raw_without_grow(bytes).unwrap()
|
||||
}
|
||||
|
||||
#[allow(clippy::mut_from_ref)] // arena allocator
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue