-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: unnested_or_patterns
FP on structs with only shorthand field pats
#15343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
r? @Alexendoo rustbot has assigned @Alexendoo. Use |
@@ -325,7 +325,11 @@ fn extend_with_struct_pat( | |||
if idx_1 == idx { | |||
// In the case of `k`, we merely require identical field names | |||
// so that we will transform into `ident_k: p1_k | p2_k`. | |||
let pos = fps2.iter().position(|fp2| eq_id(fp1.ident, fp2.ident)); | |||
let pos = fps2.iter().position(|fp2| { | |||
// Avoid `Foo { bar } | Foo { bar }` => `Foo { bar | bar }` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this comment is demonstrably correct, I think I'm still missing something -- namely, even before this PR, a pattern like this:
Foo { x, y: 1} | Foo { x, y: 2 }
still only got the suggestion to collapse the y
part, even though x
is technically duplicated as well.
So for some reason, the "deduplication" of x
isn't suggested until there aren't any other field patterns to flag (that's also why I called the PR what I did)
4fdb34c
to
d6b700b
Compare
@Alexendoo friendly ping |
r? clippy |
Error: Parsing assign command in comment failed: ...'' | error: specify user to assign to at >| ''... Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip. |
d6b700b
to
0d479c1
Compare
changelog: [
unnested_or_patterns
]: FP on structs with only shorthand field patternsfixes #15219