Skip to content

Remove unnecessary reserve in BufferVec::push#23550

Open
beicause wants to merge 1 commit intobevyengine:mainfrom
beicause:buffervec-unnecessary-reserve
Open

Remove unnecessary reserve in BufferVec::push#23550
beicause wants to merge 1 commit intobevyengine:mainfrom
beicause:buffervec-unnecessary-reserve

Conversation

@beicause
Copy link
Copy Markdown
Contributor

Objective

In #22470 (comment) I thought Vec::extend(repeat_n( ... )) doesn't have TrustedLen optimization but I was wrong! Rust std is allowed to use unstable features internally. See https://godbolt.org/z/x4sGj9on9 the generated MIR uses Vec::extend_trusted.

Solution

Remove the unnecessary reserve

Testing

None

@IceSentry IceSentry added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants