Make serialize_url and extract_v1 infallible#579
Merged
spacebear21 merged 2 commits intopayjoin:masterfrom Mar 15, 2025
Merged
Conversation
serialize_url returns a Result<> but an Error is never thrown. Simply return a Url instead.
Now that serialize_url is infallible, extract_v1 no longer needs to return a Result either.
Collaborator
Pull Request Test Coverage Report for Build 13845718794Details
💛 - Coveralls |
8fb0f60 to
cc905ec
Compare
benalleng
approved these changes
Mar 14, 2025
Collaborator
benalleng
left a comment
There was a problem hiding this comment.
Getting rid of the Result here seems to be a nice simplification, I couldn't find anything hidden in serialize_url or extract_v1 that would negate these being made infallible.
I can't speak to whether or not making a breaking change is worth it or not.
2 tasks
DanGould
approved these changes
Mar 15, 2025
Contributor
There was a problem hiding this comment.
ACK 2b9a6a1
I poked around to make sure the InternalCreateRequestError::Url variant thrown was still being used, and it is, so this all looks good to me.
I'm ok breaking the API, our team faces the biggest burden to make it work in bindings so lets break the API while we still have few dependencies we have capacity to communicate API breaks with.
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.
I noticed that
serialize_urlreturns aResult<Url, url::ParseError>but never actually returns anErr, so it can simply return aUrlinstead. The first commit addresses this.By extension,
Sender::extract_v1no longer needs to return aResulteither. The second commit addresses this. However, that one is a breaking change so I can remove this commit if that's undesired.