Skip to content

Conversation

@Erk-
Copy link
Contributor

@Erk- Erk- commented Jun 6, 2025

Add a new lint that warns when using a rest pattern when destructuring a struct. This lint was requested in this comment #10666 (comment) by @xxchan.

changelog: [rest_when_destructuring_struct] new lint

@rustbot
Copy link
Collaborator

rustbot commented Jun 6, 2025

r? @Alexendoo

rustbot has assigned @Alexendoo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 6, 2025
@Erk- Erk- force-pushed the lint/rest_when_destructuring_struct branch from 1504461 to 4cdbec3 Compare June 6, 2025 12:47
@Erk- Erk- requested a review from Centri3 June 14, 2025 10:20
@Erk- Erk- force-pushed the lint/rest_when_destructuring_struct branch from 72913a1 to a314686 Compare August 17, 2025 15:09
@github-actions
Copy link

github-actions bot commented Aug 17, 2025

Lintcheck changes for 2a4b3ce

Lint Added Removed Changed
clippy::rest_when_destructuring_struct 797 0 0

This comment will be updated if you push new changes

jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 24, 2025
…rors

add span to struct pattern rest (..)

Struct pattern rest (`..`) did not retain span information compared to normal fields. This patch adds span information for it.

The motivation of this patch comes from when I implemented this PR for Clippy: rust-lang/rust-clippy#15000 (comment)

It is possible to get the span of the Et cetera in a bit roundabout way, but I thought this would be nicer.
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 24, 2025
…rors

add span to struct pattern rest (..)

Struct pattern rest (`..`) did not retain span information compared to normal fields. This patch adds span information for it.

The motivation of this patch comes from when I implemented this PR for Clippy: rust-lang/rust-clippy#15000 (comment)

It is possible to get the span of the Et cetera in a bit roundabout way, but I thought this would be nicer.
fmease added a commit to fmease/rust that referenced this pull request Sep 1, 2025
…rors

add span to struct pattern rest (..)

Struct pattern rest (`..`) did not retain span information compared to normal fields. This patch adds span information for it.

The motivation of this patch comes from when I implemented this PR for Clippy: rust-lang/rust-clippy#15000 (comment)

It is possible to get the span of the Et cetera in a bit roundabout way, but I thought this would be nicer.
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 2, 2025
…rors

add span to struct pattern rest (..)

Struct pattern rest (`..`) did not retain span information compared to normal fields. This patch adds span information for it.

The motivation of this patch comes from when I implemented this PR for Clippy: rust-lang/rust-clippy#15000 (comment)

It is possible to get the span of the Et cetera in a bit roundabout way, but I thought this would be nicer.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Sep 2, 2025
…rors

add span to struct pattern rest (..)

Struct pattern rest (`..`) did not retain span information compared to normal fields. This patch adds span information for it.

The motivation of this patch comes from when I implemented this PR for Clippy: rust-lang/rust-clippy#15000 (comment)

It is possible to get the span of the Et cetera in a bit roundabout way, but I thought this would be nicer.
rust-timer added a commit to rust-lang/rust that referenced this pull request Sep 2, 2025
Rollup merge of #145783 - Erk-:et-cetera-span, r=compiler-errors

add span to struct pattern rest (..)

Struct pattern rest (`..`) did not retain span information compared to normal fields. This patch adds span information for it.

The motivation of this patch comes from when I implemented this PR for Clippy: rust-lang/rust-clippy#15000 (comment)

It is possible to get the span of the Et cetera in a bit roundabout way, but I thought this would be nicer.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 3, 2025
add span to struct pattern rest (..)

Struct pattern rest (`..`) did not retain span information compared to normal fields. This patch adds span information for it.

The motivation of this patch comes from when I implemented this PR for Clippy: rust-lang/rust-clippy#15000 (comment)

It is possible to get the span of the Et cetera in a bit roundabout way, but I thought this would be nicer.
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Sep 4, 2025
add span to struct pattern rest (..)

Struct pattern rest (`..`) did not retain span information compared to normal fields. This patch adds span information for it.

The motivation of this patch comes from when I implemented this PR for Clippy: rust-lang#15000 (comment)

It is possible to get the span of the Et cetera in a bit roundabout way, but I thought this would be nicer.
mohe2015 pushed a commit to tucan-plus/rustfmt that referenced this pull request Sep 6, 2025
add span to struct pattern rest (..)

Struct pattern rest (`..`) did not retain span information compared to normal fields. This patch adds span information for it.

The motivation of this patch comes from when I implemented this PR for Clippy: rust-lang/rust-clippy#15000 (comment)

It is possible to get the span of the Et cetera in a bit roundabout way, but I thought this would be nicer.
@rustbot

This comment has been minimized.

@Erk- Erk- force-pushed the lint/rest_when_destructuring_struct branch from 6868cd5 to b52ea0e Compare September 10, 2025 04:47
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@Erk- Erk- force-pushed the lint/rest_when_destructuring_struct branch from b52ea0e to 45d2dfa Compare October 7, 2025 20:36
@rustbot

This comment has been minimized.

Copy link
Contributor

@ada4a ada4a left a comment

Choose a reason for hiding this comment

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

Having the messages be a bit more specific really goes a long way!

Some final touches, and then it should be good to go^^

View changes since this review

@Erk- Erk- requested a review from Alexendoo October 31, 2025 03:46
@Erk- Erk- force-pushed the lint/rest_when_destructuring_struct branch from 7770ee6 to e7b7c82 Compare November 2, 2025 09:18
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@Erk- Erk- force-pushed the lint/rest_when_destructuring_struct branch from e95f141 to 2a3b768 Compare November 16, 2025 09:08
@rustbot

This comment has been minimized.

@Erk-
Copy link
Contributor Author

Erk- commented Nov 28, 2025

@Alexendoo Do you have some time to have a second look at this pr?

@rustbot

This comment has been minimized.

@Erk- Erk- force-pushed the lint/rest_when_destructuring_struct branch from 2a3b768 to b6864cc Compare December 2, 2025 20:45
@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Alexendoo
Copy link
Member

@Alexendoo Alexendoo added S-final-comment-period Status: final comment period it will be merged unless new objections are raised (~1 week) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties needs-fcp labels Dec 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 18, 2025

☔ The latest upstream changes (possibly 741b684) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-final-comment-period Status: final comment period it will be merged unless new objections are raised (~1 week)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants