Skip to content

Improve tmp iterator variable name for convert_for_to_while_let#20979

Open
A4-Tacks wants to merge 1 commit intorust-lang:masterfrom
A4-Tacks:iter-var-name-conv-for-to-while-let
Open

Improve tmp iterator variable name for convert_for_to_while_let#20979
A4-Tacks wants to merge 1 commit intorust-lang:masterfrom
A4-Tacks:iter-var-name-conv-for-to-while-let

Conversation

@A4-Tacks
Copy link
Member

@A4-Tacks A4-Tacks commented Nov 6, 2025

Example

fn main() {
    let x = vec![1, 2, 3];
    for$0 v in x {
        let y = v * 2;
    };
}

Before this PR

fn main() {
    let x = vec![1, 2, 3];
    let mut tmp = x.into_iter();
    while let Some(v) = tmp.next() {
        let y = v * 2;
    };
}

After this PR

fn main() {
    let x = vec![1, 2, 3];
    let mut iter = x.into_iter();
    while let Some(v) = iter.next() {
        let y = v * 2;
    };
}

Example
---
```rust
fn main() {
    let x = vec![1, 2, 3];
    for$0 v in x {
        let y = v * 2;
    };
}
```

**Before this PR**

```rust
fn main() {
    let x = vec![1, 2, 3];
    let mut tmp = x.into_iter();
    while let Some(v) = tmp.next() {
        let y = v * 2;
    };
}
```

**After this PR**

```rust
fn main() {
    let x = vec![1, 2, 3];
    let mut iter = x.into_iter();
    while let Some(v) = iter.next() {
        let y = v * 2;
    };
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 6, 2025
@A4-Tacks A4-Tacks mentioned this pull request Nov 19, 2025
41 tasks
@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Mar 22, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants