Add allow-panic-in-result-fn-in-tests configuration - #17516
Open
dcsommer wants to merge 1 commit into
Open
Conversation
dcsommer
force-pushed
the
master
branch
3 times, most recently
from
August 7, 2026 15:25
7e677ee to
c8932dc
Compare
Add a dedicated test exemption for `panic_in_result_fn` rather than broadening `allow-panic-in-tests`, since this lint also covers assertions. Apply it to test functions and code under `#[cfg(test)]`. changelog: [`panic_in_result_fn`]: add `allow-panic-in-result-fn-in-tests` to allow panics and assertions in tests
dcsommer
marked this pull request as ready for review
August 7, 2026 16:43
4 tasks
Author
|
Note, I'd prefer to ship #17520 -- this PR is only a backup in case that is not accepted. |
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.
changelog: [
panic_in_result_fn]: addallow-panic-in-result-fn-in-teststo allow panics and assertions in testsallow-panic-in-testsonly configures thepaniclint and does notsuppress
panic_in_result_fn.Add a dedicated
allow-panic-in-result-fn-in-testsconfiguration option. It uses the same expression-level test detection as the otherallow-*-in-testsoptions and coverspanic!,assert!,assert_eq!, andassert_ne!.This intentionally retains the existing behavior for integration tests and benchmarks, which are compiled as ordinary targets rather than
#[cfg(test)]code.