Skip to content

Add cop to disallow case structures where all when clauses are proc literals#797

Open
rwstauner wants to merge 2 commits into
mainfrom
rwstauner/case-when-all-procs
Open

Add cop to disallow case structures where all when clauses are proc literals#797
rwstauner wants to merge 2 commits into
mainfrom
rwstauner/case-when-all-procs

Conversation

@rwstauner

Copy link
Copy Markdown

An if/else tree is equivalent without allocating the procs.

This also triggers if the only non-proc clauses are literal values.

@rwstauner rwstauner requested a review from a team as a code owner July 15, 2026 19:28
…iterals

An if/else tree is equivalent without allocating the procs.

This also triggers if the only non-proc clauses are literal values.
@rwstauner rwstauner force-pushed the rwstauner/case-when-all-procs branch from 5230147 to f705f00 Compare July 15, 2026 19:29
This automated commit dumps the contents of the full RuboCop config.

[dependabot skip]
@sambostock

Copy link
Copy Markdown
Contributor

This feels like one of those things where maybe we should be taking a look at solving it at the interpreter level. Is there a reason an if/elsif/else chain can avoid the allocation, but a case can't?

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.

2 participants