Skip to content

Replace unwrap with expect#214

Open
prk-Jr wants to merge 4 commits intomainfrom
192-replace-unwrap-with-expect-or-operator-in-production-code
Open

Replace unwrap with expect#214
prk-Jr wants to merge 4 commits intomainfrom
192-replace-unwrap-with-expect-or-operator-in-production-code

Conversation

@prk-Jr
Copy link
Collaborator

@prk-Jr prk-Jr commented Jan 29, 2026

Replace unwrap() with expect() or ? operator in production code

Resolves: #192

The base64 decode in compute_encrypted_sha256_token cannot fail
because it operates on data just encoded by encode_url. Changed
from silent error recovery to an explicit expect with documentation
explaining the invariant.

Resolves: #192
@prk-Jr prk-Jr linked an issue Jan 29, 2026 that may be closed by this pull request
@prk-Jr prk-Jr self-assigned this Jan 29, 2026
Copy link
Collaborator

@ChristianPavilonis ChristianPavilonis left a comment

Choose a reason for hiding this comment

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

The issue #192 has 5 files to look at.

If they didn't require changes please state why those unwrap(), unwrap_or_default(), etc. are not an issue.

The unwraps in proxy.rs are in the tests but could probably use expects in case those tests fail for better visibility as to why they failed.

@aram356 aram356 self-requested a review February 4, 2026 06:39
prk-Jr and others added 3 commits February 5, 2026 18:07
When tests fail, expect provides descriptive error messages instead
of generic panic locations. This makes debugging test failures much
faster by immediately showing what operation failed.

Changes across 19 files, 164+ conversions total. The only exclusion
is build.rs which explicitly allows unwrap via clippy directive.
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.

Replace unwrap() with expect() or ? operator in production code

2 participants