Skip to content

Conversation

@A4-Tacks
Copy link
Member

Example

fn foo() -> (i32, i32) {
    if foo {} el$0
    (2, 3)
}

Before this PR

...
kw crate::
kw false
kw for
...

After this PR

...
kw crate::
kw else
kw else if
kw false
kw for
...

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 19, 2026
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nit.

non_trivia_sibling(node.into(), Direction::Prev).and_then(NodeOrToken::into_node);
iter::successors(prev_sibling, |it| it.last_child_or_token()?.into_node())
let Some(prev_token) = previous_non_trivia_token(node) else { return false };
iter::successors(prev_token.parent(), |it| it.parent())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
iter::successors(prev_token.parent(), |it| it.parent())
prev_token.parent_ancestors()

@A4-Tacks A4-Tacks force-pushed the comp-else-before-tuple branch from b447f9a to af8bb81 Compare January 26, 2026 05:24
Example
---
```rust
fn foo() -> (i32, i32) {
    if foo {} el$0
    (2, 3)
}
```

**Before this PR**

```rust
...
kw crate::
kw false
kw for
...
```

**After this PR**

```rust
...
kw crate::
kw else
kw else if
kw false
kw for
...
```
@A4-Tacks A4-Tacks force-pushed the comp-else-before-tuple branch from af8bb81 to cc725f8 Compare January 26, 2026 05:36
@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Jan 26, 2026
Merged via the queue into rust-lang:master with commit cf38ac2 Jan 26, 2026
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 26, 2026
@A4-Tacks A4-Tacks deleted the comp-else-before-tuple branch January 26, 2026 14:29
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