Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove unused loops in deferred checks#23624

Open
ntBre wants to merge 1 commit intomainfrom
brent/deferred
Open

Remove unused loops in deferred checks#23624
ntBre wants to merge 1 commit intomainfrom
brent/deferred

Conversation

@ntBre
Copy link
Contributor

@ntBre ntBre commented Feb 27, 2026

Summary

While reviewing #23473, I noticed that the while loops in our deferred checks
for for loops and lambdas would only be used if we pushed additional deferred
scopes to the Checker while running lint rule code. This should actually be
impossible given that the rules only receive a &Checker (as shown by the
immutable re-borrow), and none of our tests fail when removing the loops.

I guess it doesn't hurt to have the loops either since they only run once, but
it did serve to confuse me today.

I assume, but didn't fully confirm, that this used to be interleaved with the
visiting phase, at which point additional deferred scopes could have still been
added in the middle of this.

Test Plan

Existing tests

Summary
--

While reviewing #23473, I noticed that the `while` loops in our deferred checks
for `for` loops and lambdas would only be used if we pushed additional deferred
scopes to the `Checker` while running lint rule code. This should actually be
impossible given that the rules only receive a `&Checker` (as shown by the
immutable re-borrow), and none of our tests fail when removing the loops.

I guess it doesn't hurt to have the loops either since they only run once, but
it did serve to confuse me today.

I assume, but didn't fully confirm, that this used to be interleaved with the
visiting phase, at which point additional deferred scopes could have still been
added in the middle of this.

Test Plan
--

Existing tests
@ntBre ntBre added the internal An internal refactor or improvement label Feb 27, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 27, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre marked this pull request as ready for review February 27, 2026 23:10
@ntBre ntBre requested a review from MichaReiser February 27, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants