Skip to content

style(body,proto): enforce clippy::rest_pattern_accessible_field - #4230

Open
cratelyn wants to merge 1 commit into
masterfrom
kate/rest-pattern-accessible-field
Open

cratelyn wants to merge 1 commit into
masterfrom
kate/rest-pattern-accessible-field

Conversation

@cratelyn

@cratelyn cratelyn commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

see #4071.

see https://rust-lang.github.io/rust-clippy/master/index.html#rest_pattern_accessible_field.

this lint disallows .. patterns for accessible fields. this is helpful
because it calls attention to locations that may need to be updated when
the contents of a structure changes.

allowances are left in place for simple accessors. because the
lint_reason feature is not supported across the range of our MSRV, we
use /*reason: explanation*/ comments for now.

an explicit allowance of unneeded_field_pattern is added, because
these two lints conflict: we can either expect exhaustive matching, or
we can expect that no fields are explicitly ignored. the former is more
verbose, but draws attention to where logic may need to be updated as a
type evolves over time.

see #4071.

see <https://rust-lang.github.io/rust-clippy/master/index.html#rest_pattern_accessible_field>.

this lint disallows `..` patterns for accessible fields. this is helpful
because it calls attention to locations that may need to be updated when
the contents of a structure changes.

allowances are left in place for simple accessors. because the
lint_reason feature is not supported across the range of our MSRV, we
use `/*reason: explanation*/` comments for now.

an explicit allowance of `unneeded_field_pattern` is added, because
these two lints conflict: we can either expect exhaustive matching, or
we can expect that no fields are explicitly ignored. the former is more
verbose, but draws attention to where logic may need to be updated as a
type evolves over time.

Signed-off-by: katelyn martin <git@katelyn.world>
@cratelyn
cratelyn marked this pull request as ready for review October 10, 2026 04:07

@dswij dswij left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually still torn on this. Not sure if I completely like defaulting to exhaustive matching, but I wouldn't mind it either. 🤔

Comment thread src/proto/h1/io.rs
}
}

#[allow(clippy::rest_pattern_accessible_field/*reason: this is an accessor*/)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

After rustc version 1.81.0 this can use expect and lint reason

#[expect(clippy::rest_pattern_accessible_field), reason = ".."]

This branch has not been deployed

No deployments
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.

2 participants