refactor(allocator): move nested function out of FixedSizeAllocatorPool::get#17078
Conversation
camc314
left a comment
There was a problem hiding this comment.
lol, claude suggested this change while I was working on it, and I deliberately didn't do it because it felt like I was mixing the two concerns of the pool and the fixed size allocator.
Iirc, it's also unsafe to call this function on a fixed size allocator if you didn't get it out of the pool?
There was a problem hiding this comment.
Pull request overview
This PR refactors the FixedSizeAllocatorPool::get method by extracting a nested function into a proper method on FixedSizeAllocator. The change improves code readability without altering any logic.
- Moved nested
into_allocatorfunction toFixedSizeAllocator::into_innermethod - Added explanatory comments to the
getmethod flow - Added
#[inline]attribute to optimize the no-op method
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CodSpeed Performance ReportMerging #17078 will not alter performanceComparing Summary
Footnotes
|
This whole thing with fixed size allocators is held together with gaffer tape and string. It's a disaster area, and UB is only a slip of the keyboard away. Everything is entwined with each-other, and it's gratuitously unsound. So I don't think separation of concerns really applies - and that's the problem - there isn't any!
Correct. But there's nowhere else to get one. |
024ab0a to
e8c0e07
Compare
1f5a828 to
348c622
Compare
Merge activity
|
e8c0e07 to
d37d728
Compare
348c622 to
40a30fe
Compare

Follow-on after #17023. Pure refactor.
Move code out of
FixedSizeAllocatorPool::get, to make it easier to read. Also add comments.