Mark unreachable panics with #[expect(clippy::missing_panics_doc)] - #10761
Draft
emilk wants to merge 5 commits into
Draft
Mark unreachable panics with #[expect(clippy::missing_panics_doc)]#10761emilk wants to merge 5 commits into
#[expect(clippy::missing_panics_doc)]#10761emilk wants to merge 5 commits into
Conversation
A handful of `unwrap`/`expect`/`assert!` calls cannot fail, but removing them would need real restructuring. Silence `clippy::missing_panics_doc` for those with a reason instead of documenting a panic that cannot happen. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Tests, benchmarks and their helpers are free to panic, so silence `clippy::missing_panics_doc` for those files instead of documenting each function. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`arrow::util::test_util` and `arrow::util::bench_util` are public, and the file-level `#![expect(clippy::missing_panics_doc)]` means callers get no panic documentation at all. State it once in the module docs instead. Also records the tests-and-benches convention in CONTRIBUTING.md, next to the existing guidance on suppressing lints. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…many` The offsets of an array of length `size` always yield `size + 1` values, so the `peek`/`next` calls over them cannot fail. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The crate is `publish = false` and, in its own words, holds the "binaries used in the Arrow integration tests". Nothing downstream reads its docs and its helpers are free to panic, so suppress the lint for the whole crate rather than documenting a panic per function. `arrow-integration-test` keeps its `# Panics` sections: it is published, as support for the Arrow JSON test data format. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
emilk
force-pushed
the
emilk/panics-expect
branch
from
August 19, 2026 19:29
e60e569 to
b0c9235
Compare
This was referenced Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
This is one of four PRs splitting up the
clippy::missing_panics_docwork.Each one stands on its own and touches its own set of functions, but they are
meant to land in order, since the later ones assume the earlier ones:
unwraps #10759 - remove unreachable panics#[expect(clippy::missing_panics_doc)]#10761 -#[expect]the unreachable ones, so the lint can be turned onWhat is left after the first three PRs is functions whose
unwrapcannot fail,but where removing it would mean restructuring code for no gain. Those get an
#[expect]with a reason, which is the repo's documented convention for a lintyou disagree with on a given item.
With all four merged,
clippy::missing_panics_docis clean across the workspace,so it can be turned on with the rest of the pedantic lints.
What changes are included in this PR?
#[expect(clippy::missing_panics_doc, reason = "...")]on the functions whosepanic is unreachable, each reason naming the invariant that makes it so, for
example "an
OffsetBufferis never empty" or "an array always matches theconcrete type of its data type"
#![expect(...)]for tests, benchmarks and the helpers they use,since those are free to panic
arrow-integration-testingcrate, which ispublish = falseand holds only the integration test binaries, so nothingdownstream reads its docs.
arrow-integration-testkeeps its# Panicssections, since it is published
suppressing lints
The lint itself is still not enabled here; that comes with the rest of the
pedantic lints.
One trivial conflict is expected against #10755: both add something directly
above
concat_elements_utf8_many, an# Errorssection there and an#[expect]here. Keep both. It resolves itself when this branch is rebased after #10755
lands.
Are these changes tested?
Verified with
cargo clippy --workspace --all-features --all-targetswithmissing_panics_doc = "warn"added to[workspace.lints.clippy]locally, on topof the other three PRs: no warnings, and no unfulfilled expectations.
Are there any user-facing changes?
No.