Skip to content

feat: add expected name on simple enum variant#21892

Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
A4-Tacks:enum-variant-expect-name
Mar 31, 2026
Merged

feat: add expected name on simple enum variant#21892
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
A4-Tacks:enum-variant-expect-name

Conversation

@A4-Tacks
Copy link
Copy Markdown
Member

Example

struct Other;
struct String;
enum Foo {
    String($0)
}

Before this PR

en Foo Foo []
st Other Other []
sp Self Foo []
st String String []

After this PR

st String String [name]
en Foo Foo []
st Other Other []
sp Self Foo []

Example
---
```rust
struct Other;
struct String;
enum Foo {
    String($0)
}
```

**Before this PR**

```text
en Foo Foo []
st Other Other []
sp Self Foo []
st String String []
```

**After this PR**

```text
st String String [name]
en Foo Foo []
st Other Other []
sp Self Foo []
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 28, 2026
@ChayimFriedman2
Copy link
Copy Markdown
Contributor

I'm not sure what this does. Why did the scoring change?

@A4-Tacks
Copy link
Copy Markdown
Member Author

Suggest variant name within simple tuple variants

This is beneficial for writing String(String), Error(Error), etc

Why did the scoring change?

Because the name matches, as described in the test

Copy link
Copy Markdown
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.

Got it, it doesn't hurt I guess.

View changes since this review

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Mar 31, 2026
Merged via the queue into rust-lang:master with commit b9185af Mar 31, 2026
17 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 31, 2026
@A4-Tacks A4-Tacks deleted the enum-variant-expect-name branch March 31, 2026 03:42
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