Skip to content

Inline only-used-once closures in ExprConcatStrings::eval#14443

Merged
xokdvium merged 2 commits into
masterfrom
inline-unreused-lambda
Nov 1, 2025
Merged

Inline only-used-once closures in ExprConcatStrings::eval#14443
xokdvium merged 2 commits into
masterfrom
inline-unreused-lambda

Conversation

@Ericson2314
Copy link
Copy Markdown
Member

@Ericson2314 Ericson2314 commented Nov 1, 2025

Motivation

Refactor ExprConcatStrings::eval by inlining two only-called-once closures into the call-site, so that the code is easier to reason about locally (especially since the variables that were closed over were mutated all over the place within this function).

Also use curly braces with each branch for consistency in the the
resulting code.

This is a pure refactor, but also arguably causes us to depend less on
the optimizer; now, we don't have to make sure that this closure is
inlined.

Context

The change is from @glittershark, with just rebases and git chores from me. It is extracted from #14442.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Ericson2314 and others added 2 commits November 1, 2025 13:41
It deserves a better name.

Co-Authored-By: Aspen Smith <root@gws.fyi>
Refactor `ExprConcatStrings::eval` by inlining two only-called-once
closures into the call-site, so that the code is easier to reason about
locally (especially since the variables that were closed over were
mutated all over the place within this function).

Also use curly braces with each branch for consistency in the the
resulting code.

This is a pure refactor, but also arguably causes us to depend less on
the optimizer; now, we don't have to make sure that this closure is
inlined.
@xokdvium xokdvium added this pull request to the merge queue Nov 1, 2025
Merged via the queue into master with commit e4e4063 Nov 1, 2025
22 checks passed
@xokdvium xokdvium deleted the inline-unreused-lambda branch November 1, 2025 22:30
@edolstra edolstra mentioned this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants